Quantcast
Channel: VBForums - Visual Basic .NET
Viewing all articles
Browse latest Browse all 27209

VS 2012 Creating/operating textbox's

$
0
0
Hi everybody,

After some research, I’ve missed to find out solution to this problem:
I’m using VB to read a 4 sensor kit. Up till now I’ve been able to read and interrogate the kit.

To improve my work I want to show only the existing sensors, if I’ve 4 sensors I’ll create and show 4 textbox, if i only have 2 sensors I don’t want to show unnecessary textbox…If I’m using only 2 sensors I know that i can use the “hide” command, but if more kits are added (*4 sensors each) this is not a good solution...

Here the actual code in example:
Code:

        If nbrkit = 1 Then
            AddHandler evalkit1.FrameReceived, (AddressOf evalKit_FrameReceived)
            AddHandler evalkit1.Connected, (AddressOf evalKit_Connected)
            evalkit1.Connect(portNames(0))
            TextBox10.Hide()
            TextBox11.Hide()
            TextBox12.Hide()
            TextBox13.Hide()
            TextBox14.Hide()
            TextBox15.Hide()
            TextBox16.Hide()
            TextBox17.Hide()
            TextBox18.Hide()
            TextBox19.Hide()
            TextBox20.Hide()
            TextBox21.Hide()
            TextBox22.Hide()
            TextBox23.Hide()
            TextBox24.Hide()
            TextBox25.Hide()
            Label15.Hide()
            Label14.Hide()
            Label13.Hide()
            Label20.Hide()
            Label21.Hide()
            Label22.Hide()
            Me.Location = New Point(10, 10)
            Me.ClientSize = New System.Drawing.Size(380, 370)

        ElseIf nbrkit = 2 Then
            AddHandler evalkit1.FrameReceived, (AddressOf evalKit_FrameReceived)
            AddHandler evalkit1.Connected, (AddressOf evalKit_Connected)
            evalkit1.Connect(portNames(0))
            AddHandler evalkit2.FrameReceived, (AddressOf evalKit_FrameReceived)
            AddHandler evalkit2.Connected, (AddressOf evalKit_Connected)
            evalkit2.Connect(portNames(1))
            TextBox18.Hide()
            TextBox19.Hide()
            TextBox20.Hide()
            TextBox21.Hide()
            TextBox22.Hide()
            TextBox23.Hide()
            TextBox24.Hide()
            TextBox25.Hide()
            Label20.Hide()
            Label21.Hide()
            Label22.Hide()
            Me.Location = New Point(10, 10)
            Me.ClientSize = New System.Drawing.Size(650, 370)
        ElseIf nbrkit = 3 Then
            AddHandler evalkit1.FrameReceived, (AddressOf evalKit_FrameReceived)
            AddHandler evalkit1.Connected, (AddressOf evalKit_Connected)
            evalkit1.Connect(portNames(0))
            AddHandler evalkit2.FrameReceived, (AddressOf evalKit_FrameReceived)
            AddHandler evalkit2.Connected, (AddressOf evalKit_Connected)
            evalkit2.Connect(portNames(1))
            AddHandler evalkit3.FrameReceived, (AddressOf evalKit_FrameReceived)
            AddHandler evalkit3.Connected, (AddressOf evalKit_Connected)
            evalkit3.Connect(portNames(2))

Name:  Image1.png
Views: 46
Size:  184.0 KB

I don’t know if it is possible to use the textbox object with increment, something as

With a and c defined by me or the values obtained

For i=1 to c
If condition a = true then
“Create”.textbox(i)
Textbox(i).Location = New Point(10, 10)
End if
next

Most of all I want to be able to create/locate a new textbox whenever certain conditions are acquired.

Thank you for the help in advance.
Attached Images
 

Viewing all articles
Browse latest Browse all 27209

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>