myform.Controls.Item(i)

  • Thread starter Thread starter Murat Kelleci
  • Start date Start date
M

Murat Kelleci

Form:
addlist(me)

Module:

Sub addlist(ByVal myform As Form)

Dim myList As New ListBox()

myList = myform.Controls.Item(1)

mylist.items.add("test")

End Sub


I have many listboxes and text boxes and i can find their control index
number to use like myform.control.item(i).
Can u help me?
 
* "Murat Kelleci said:
Form:
addlist(me)

Module:

Sub addlist(ByVal myform As Form)

Dim myList As New ListBox()

'As New' doesn't make sense here. Skip the 'New'.
myList = myform.Controls.Item(1)

mylist.items.add("test")

End Sub


I have many listboxes and text boxes and i can find their control index
number to use like myform.control.item(i).

???
 
I have many listboxes and text boxes and i can find their control index
number to use like myform.control.item(i).
Can u help me?

I don't understand your question, would you please re-phrase it?

sincerely,
--
Sebastian Zaklada
Skilled Software
http://www.skilledsoftware.com
************************************
SQL Source Control 2003 - for
SQL Server Source Safe integration
and custom databases documentation
 
Dim c As Windows.Forms.Control

For Each c In Me.Controls

If c.GetType.ToString() = "System.Windows.Forms.TextBox" Then

MsgBox(c.Text)

End If

Next

Regards - OHM



Murat said:
Form:
addlist(me)

Module:

Sub addlist(ByVal myform As Form)

Dim myList As New ListBox()

myList = myform.Controls.Item(1)

mylist.items.add("test")

End Sub


I have many listboxes and text boxes and i can find their control
index number to use like myform.control.item(i).
Can u help me?

Regards - OHM# OneHandedMan{at}BTInternet{dot}com
 
One Handed Man said:
Dim c As Windows.Forms.Control

For Each c In Me.Controls

If c.GetType.ToString() = "System.Windows.Forms.TextBox"
Then

or:
If TypeOf c Is System.Windows.Forms.Textbox Then
 
* "One Handed Man said:
Dim c As Windows.Forms.Control

For Each c In Me.Controls

If c.GetType.ToString() = "System.Windows.Forms.TextBox" Then

Why not 'If TypeOf c Is TextBox Then'?
 
I think Armin is referencing a very long thread on Type Casting we were
involved in.

Regards - OHM
Who is "we"?

:-)))

Regards - OHM# OneHandedMan{at}BTInternet{dot}com
 
It Voz a Joke !

I vill hold up mine hand ( mine only hand ) next time to signal you to laugh
!!

ROTFL


Regards - OHM


I didn't doubt that.

Regards - OHM# OneHandedMan{at}BTInternet{dot}com
 
I have not seen a pInvoke in this thread so it is not something Herfried
likes
You and I, because we gave the same answer.

(I know the answer from Armin on this)

:-))

Cor
 
* "One Handed Man said:
It Voz a Joke !

I vill hold up mine hand ( mine only hand ) next time to signal you to laugh
!!

ROTFL

LOL -- I dodn't interpret the ")=" as a smiley...

;-)
 
Back
Top