ultraman Posted September 3, 2003 Posted September 3, 2003 There's once again trouble in Dreamland ! In an ancien era where dinosaurs and VB6 ruled the world, there was an easy too use (yet very practical) function named "Array" that tranformed everything in (guess what ?) an Array ! Now, the evil Bill destroyed that function so that we have to waste our time finding new (more complicated) solutions. Is there anyone outhere that would have found something that would work approximately like the Array function ? Quote Now go on, boy, and pay attention. Because if you do, someday, you may achieve something that we Simpsons have dreamed about for generations: You may outsmart someone! --Homer Simpson
aewarnick Posted September 3, 2003 Posted September 3, 2003 I have no idea what the VB6 Array function was but here are 2 thoughts: Array class to manipulate an array's data. ArrayList to add and remove items easily. Quote C#
*Experts* mutant Posted September 3, 2003 *Experts* Posted September 3, 2003 ArrayList should work well, even better than using the Array functinon. What is that you are trying to do? Quote
ultraman Posted September 3, 2003 Author Posted September 3, 2003 Well... first of all, the Array() function was working like this : Dim arrPara as Variant arrPara = Array("12", "45", "HelloWold") So there was no need for 3 lines of code (like with the .Add method of the ArrayList). But finally, I used a ParamArray in my method definition and it works fine. Public Sub SetColumnsHeaders(ByVal ParamArray pArray() As String) Dim i As Integer Try For i = LBound(pArray) To UBound(pArray) Step 2 ts.GridColumnStyles(CInt(pArray(i))).HeaderText = pArray(i + 1).ToString Next Catch e As Exception MessageBox.Show(e.Message) End Try End Sub 'Call the sub SetColumnsHeaders("0", "Number", "1", "Region", "2", "Members") Quote Now go on, boy, and pay attention. Because if you do, someday, you may achieve something that we Simpsons have dreamed about for generations: You may outsmart someone! --Homer Simpson
*Experts* Volte Posted September 3, 2003 *Experts* Posted September 3, 2003 The Array() function in VB6 was rather ugly because it returned a variant array. There's an equally easy way in .NET which is not ugly at all:Dim stringArray As String() = {"Item 1", "Item 2", "Item 3"}Equiv in VB6 to Dim stringArray() As String stringArray = Array("Item 1", "Item 2", "Item 3") Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.