Can some body convert this c# code to VB.NET
-
public static Control AdvancedFindControl(this Control container, string controlId) { Queue controlQueue = new Queue(new[] { container }); Control currentControl; while (controlQueue.Count > 0) { currentControl = controlQueue.Dequeue(); foreach (Control child in currentControl.Controls) { controlQueue.Enqueue(child); } if (currentControl.ID == controlId) return currentControl; } return null; }
thanks in adv -
public static Control AdvancedFindControl(this Control container, string controlId) { Queue controlQueue = new Queue(new[] { container }); Control currentControl; while (controlQueue.Count > 0) { currentControl = controlQueue.Dequeue(); foreach (Control child in currentControl.Controls) { controlQueue.Enqueue(child); } if (currentControl.ID == controlId) return currentControl; } return null; }
thanks in advtry this website, there are plenty more out there http://www.kamalpatel.net/ConvertCSharp2VB.aspx
-
try this website, there are plenty more out there http://www.kamalpatel.net/ConvertCSharp2VB.aspx
-
public static Control AdvancedFindControl(this Control container, string controlId) { Queue controlQueue = new Queue(new[] { container }); Control currentControl; while (controlQueue.Count > 0) { currentControl = controlQueue.Dequeue(); foreach (Control child in currentControl.Controls) { controlQueue.Enqueue(child); } if (currentControl.ID == controlId) return currentControl; } return null; }
thanks in advPublic Shared Function AdvancedFindControl(ByVal Control As Me, ByVal controlId As String) As Control Dim controlQueue As Queue = New Queue(New() { container } ) Dim currentControl As Control While controlQueue.Count > 0 currentControl = controlQueue.Dequeue() Dim child As Control For Each child In currentControl.Controls controlQueue.Enqueue(child) Next If currentControl.ID = controlId Then Return currentControl End If End While Return Nothing End Function
-
public static Control AdvancedFindControl(this Control container, string controlId) { Queue controlQueue = new Queue(new[] { container }); Control currentControl; while (controlQueue.Count > 0) { currentControl = controlQueue.Dequeue(); foreach (Control child in currentControl.Controls) { controlQueue.Enqueue(child); } if (currentControl.ID == controlId) return currentControl; } return null; }
thanks in advThis is not valid C# code - you're missing a type name after 'new': ...new Queue(new[] { container }); I would expect something like: ...new Queue(new Foo[] { container });
David Anton http://www.tangiblesoftwaresolutions.com C++ to C# Converter C++ to VB Converter C++ to Java Converter Instant C#: VB to C# converter Instant VB: C# to VB converter Instant C++: convert VB, C#, or Java to C++/CLI Java to VB & C# Converter: convert Java to VB or C#
-
This is not valid C# code - you're missing a type name after 'new': ...new Queue(new[] { container }); I would expect something like: ...new Queue(new Foo[] { container });
David Anton http://www.tangiblesoftwaresolutions.com C++ to C# Converter C++ to VB Converter C++ to Java Converter Instant C#: VB to C# converter Instant VB: C# to VB converter Instant C++: convert VB, C#, or Java to C++/CLI Java to VB & C# Converter: convert Java to VB or C#
Whoa ... posted too soon - this is valid C# syntax - I'm working on the VB equivalent - stay tuned.
David Anton http://www.tangiblesoftwaresolutions.com C++ to C# Converter C++ to VB Converter C++ to Java Converter Instant C#: VB to C# converter Instant VB: C# to VB converter Instant C++: convert VB, C#, or Java to C++/CLI Java to VB & C# Converter: convert Java to VB or C#
-
Whoa ... posted too soon - this is valid C# syntax - I'm working on the VB equivalent - stay tuned.
David Anton http://www.tangiblesoftwaresolutions.com C++ to C# Converter C++ to VB Converter C++ to Java Converter Instant C#: VB to C# converter Instant VB: C# to VB converter Instant C++: convert VB, C#, or Java to C++/CLI Java to VB & C# Converter: convert Java to VB or C#
Apparently, there is no VB equivalent to an inferred array initialization (e.g., "new[] {...}" in C#3) The following was produced with Instant VB, with one manual adjustment - adding "Control" after the 'New': _ Public Shared Function AdvancedFindControl(ByVal container As Control, ByVal controlId As String) As Control Dim controlQueue As New Queue(New Control() { container }) Dim currentControl As Control Do While controlQueue.Count > 0 currentControl = controlQueue.Dequeue() For Each child As Control In currentControl.Controls controlQueue.Enqueue(child) Next child If currentControl.ID = controlId Then Return currentControl End If Loop Return Nothing End Function David Anton http://www.tangiblesoftwaresolutions.com C++ to C# Converter C++ to VB Converter C++ to Java Converter Instant C#: VB to C# converter Instant VB: C# to VB converter Instant C++: convert VB, C#, or Java to C++/CLI Java to VB & C# Converter: convert Java to VB or C#