You need a better vb to c# converter - try Instant C# (wwww.instantcsharp.com). I used it to get:
public string this[int index]
{
get
{
return List[index].ToString();
}
set
{
List[index] = value;
}
}
The VB.NET to C# converter Instant C# makes a static class available to mimic the robustness of the VB cast macro "CInt":
internal static int CInt(object oValue)
{
try
{
if (oValue == null || System.Convert.IsDBNull(oValue))
//default null to 0 (identical to the VB.NET cast):
return...
Using the Instant C# VB.NET to C# converter (www.instantcsharp.com), I get:
//TODO: INSTANT C# TODO TASK: Insert the following converted event handlers at the end of the 'InitializeComponent' method for forms or into a constructor for other classes:
//DataList1.ItemDataBound += new...
Just out of curiousity, why not use MessageBox.Show ?
It's virtually identical - the enums match pretty well one-to-one. (in the System.Windows.Forms namespace which you're probably using anyway)
Download a good vb to c# converter. Instant C# is the best one I know of (www.instantcsharp.com) - the demo would probably be all you need to convert some small samples as you need it to see how some things are done in C# vs VB.
Quote (is there a way to do quotes on this group?):
So are VC# and VB.Net basically the same except for the
way you write your blocks, and syntax structure?
Actually, the syntax differences are more substantial than first appears. There's a good short summary of some of the more devious ones...
Well, you'd have to have Try/Catch around every line of code in order to reproduce the functionality of Resume Next. I didn't think of that when I said the only option was to have a line counter and goto's, but even so you wouldn't want to have Try/Catch around every line.
The 'trick' of the...
Personally, I don't see Try/Catch as a huge improvement, although I like exceptions better than meaningless error numbers.
Contrary to what someone posted here, there is no Try/Catch equivalent to "Resume Next". To ignore the exception in the Catch block, you're not resuming at the line...
It's the .net approach to error handling.
Try: the mainstream logic
Catch: where you 'goto' when something goes wrong
Finally: do this stuff *always*, even if something goes wrong.
Using Instant C# (the vb.net to c# converter), here's an example of old vb6-style error handling in vb.net and...
This is one of the less obvious parts of the C# IDE. I just recently found out about it. Select a control, bring up the properties, and click on the lightening bolt (for events). From that property view, you'll be able to add events as easily as from VB.
In practice, using regular strings is actually very efficient when the strings are small. I write a few very intensive string manipulation apps and using StringBuilder only boosts their performance when accumulating or adding on to very large strings.
For example, if you're parsing through a...
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.