By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
443,815 Members | 1,143 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 443,815 IT Pros & Developers. It's quick & easy.

Need to convert C# code to VB.NET

P: n/a
I am trying to covert the following code to VB.NET. This code is
using reflection to auto size the columns of a grid. Unfortunately, I
am not familiar with C#. I have tried the various code converters and
the first three lines convert very nicely but it chokes on line within
the loop. Any help?
Type t = dgRows.GetType();
MethodInfo m = t.GetMethod("ColAutoResize",BindingFlags.NonPublic );
for (int i = dgRows.FirstVisibleColumn; (i <
dgLogging.VisibleColumnCount); i++)
{
m.Invoke(dgRows, new object[]{i});
}
Nov 21 '05 #1
Share this Question
Share on Google+
4 Replies


P: n/a

"Joe Book" <jo*****@hotmail.com> schrieb
I am trying to covert the following code to VB.NET. This code is
using reflection to auto size the columns of a grid. Unfortunately, I
am not familiar with C#. I have tried the various code converters and
the first three lines convert very nicely but it chokes on line within
the loop. Any help?
Type t = dgRows.GetType();
MethodInfo m = t.GetMethod("ColAutoResize",BindingFlags.NonPublic );
for (int i = dgRows.FirstVisibleColumn; (i <
dgLogging.VisibleColumnCount); i++)
{
m.Invoke(dgRows, new object[]{i});
}


Hi Joe,

Dim t As Type = dgRows.GetType()
Dim m As MethodInfo = t.GetMethod("ColAutoResize", BindingFlags.NonPublic)
For i As Integer = dgRows.FirstVisibleColumn To dgLogging.VisibleColumnCount
m.Invoke(dgRows, New Object() {i})
Next

Cheers

Arne Janning
Nov 21 '05 #2

P: n/a
* jo*****@hotmail.com (Joe Book) scripsit:
I am trying to covert the following code to VB.NET. This code is
using reflection to auto size the columns of a grid. Unfortunately, I
am not familiar with C#. I have tried the various code converters and
the first three lines convert very nicely but it chokes on line within
the loop. Any help?

Type t = dgRows.GetType();
MethodInfo m = t.GetMethod("ColAutoResize",BindingFlags.NonPublic );
for (int i = dgRows.FirstVisibleColumn; (i <
dgLogging.VisibleColumnCount); i++)
{
m.Invoke(dgRows, new object[]{i});
}


\\\
Imports System.Reflection
..
..
..
Dim t As Type = dgRows.GetType()
Dim m As MethodInfo = t.GetMethod("ColAutoResize", BindingFlags.NonPublic)
Dim i As Integer
For i = dgRows.FirstVisibleColumn To dgLogging.VisibleColumnCount - 1
m.Invoke(dgRows, New Object() {i})
Next i
///

--
M S Herfried K. Wagner
M V P <URL:http://dotnet.mvps.org/>
V B <URL:http://dotnet.mvps.org/dotnet/faqs/>
Nov 21 '05 #3

P: n/a
Herfried,

Strange some threads bellow I saw from you a statement that it was not
needed to convert from VBNet to C# and now you give in the oposite way the
code.

:-)

Cor
Nov 21 '05 #4

P: n/a
Cor,

* "Cor Ligthert" <no**********@planet.nl> scripsit:
Strange some threads bellow I saw from you a statement that it was not
needed to convert from VBNet to C# and now you give in the oposite way the
code.

:-)


Really strange, isn't it ;-)...

C# -> VB.NET = :-).
VB.NET -> C# = :-(.

--
M S Herfried K. Wagner
M V P <URL:http://dotnet.mvps.org/>
V B <URL:http://dotnet.mvps.org/dotnet/faqs/>
Nov 21 '05 #5

This discussion thread is closed

Replies have been disabled for this discussion.