Hello, I have a small programming challenge I am encountering. I am working with a multithreaded application, and with each thread, a new set of controls is created, with the thread ID and control id. For instance, if it were the 3rd thread, it could be textbox2, listbox2, checkbox2, button2 etc. In the event handler for one of my buttons to be created at runtime, I have the following code: Code (Text): <div class="text" id="{CB}" style="font-family: monospace;"><ol><li style="padding: 0 5px; background-color: #fff; line-height: 16px; border-bottom: 1px solid #efefef; border-left: 1px solid #999;"> Public Sub StartBuying(ByVal sender As Object, ByVal e As System.EventArgs)</li><li style="padding: 0 5px; background-color: #f9f9f9; line-height: 16px; border-bottom: 1px solid #efefef; border-left: 1px solid #999;"> Dim intThreadID As Integer = Int(Replace(sender.name, "cmdStart", ""))</li><li style="padding: 0 5px; background-color: #fff; line-height: 16px; border-bottom: 1px solid #efefef; border-left: 1px solid #999;"> ReDim Preserve Me.BuyThread(intThreadID)</li><li style="padding: 0 5px; background-color: #f9f9f9; line-height: 16px; border-bottom: 1px solid #efefef; border-left: 1px solid #999;"> Dim TempClassThread As BuyThreadClass</li><li style="padding: 0 5px; background-color: #fff; line-height: 16px; border-bottom: 1px solid #efefef; border-left: 1px solid #999;"> TempClassThread = New BuyThreadClass()</li><li style="padding: 0 5px; background-color: #f9f9f9; line-height: 16px; border-bottom: 1px solid #efefef; border-left: 1px solid #999;"> Me.BuyThread(intThreadID) = New System.Threading.Thread(AddressOf TempClassThread.DoStartBuying)</li><li style="padding: 0 5px; background-color: #fff; line-height: 16px; border-bottom: 1px solid #efefef; border-left: 1px solid #999;"> TempClassThread.ThreadID = intThreadID</li><li style="padding: 0 5px; background-color: #f9f9f9; line-height: 16px; border-bottom: 1px solid #efefef; border-left: 1px solid #999;"> TempClassThread.bolRunning = True</li><li style="padding: 0 5px; background-color: #fff; line-height: 16px; border-bottom: 1px solid #efefef; border-left: 1px solid #999;"> Me.BuyThread(intThreadID).IsBackground = True</li><li style="padding: 0 5px; background-color: #f9f9f9; line-height: 16px; border-bottom: 1px solid #efefef; border-left: 1px solid #999;"> Me.BuyThread(intThreadID).Start()</li><li style="padding: 0 5px; background-color: #fff; line-height: 16px; border-bottom: 1px solid #efefef; border-left: 1px solid #999;"> End Sub</li></ol></div> It creates a new class so that the "controls id" can be passed to the function the thread calls. However, even while knowing the names of the controls, I cannot access them. Any idea? Note that the controls are on a tab of a tabstrip in a tab of another tabstrip.
When you start the thread pass it the form, you can do it with a this, next make a code that will find the id and then within the thread access the form you passed formname.nameoftextbox.text. No you can only read varibles from the textbvox otherwise you have to invoke the textbpx, google vb.net invoking, I programin mostly in C# so the syntax is different but it is .net none the less.
Okay, I can access the controls, but not all of them. It's only recognizing the controls created before runtime. For instance, when the user adds an account, a new tabpage is added to the tabstrip called tabMain, which has 1 tab to begin with. When I have added an account, it should have two tabs, but if I were to msgbox tabMain.tabcount, it would say 1.
It would be easier to make a settings file for each account then load the setting file. Just a sugestion
Nevermind, I got this, and finished the program. I would post a link but I wouldn't want to be accused of advertising.