Cumbersome Solution

Tech-Archive recommends: Repair Windows Errors & Optimize Windows Performance



I ran into a small issue and I found a solution however it is cumbersome to use.

The problem and solution is describe within the MSDN article http://msdn2.microsoft.com/en-us/library/ms171728(d=ide).aspx

I would like to create one subroutine for all my textboxes and not one for each textbox, given the sample subroutine below, how can I add the textbox name into this subroutine?

Cumbersome Solution

Private Sub SetText(ByVal [text] As String)

' InvokeRequired required compares the thread ID of the

' calling thread to the thread ID of the creating thread.

' If these threads are different, it returns true.

If Me.tb_Netbios.InvokeRequired Then

Dim d As New SetTextCallback(AddressOf SetText)

Me.Invoke(d, New Object() {[text]})

Else

Me.tb_Netbios.Text = [text]

End If

End Sub


Relevant Pages

  • .net 2005 convert from VB to c++
    ... I have a subroutine I need to convert from vb.net 2005 to visual C++ ... The function only allows specific characters to be typed into a ... textbox. ... Private Sub textbox1_KeyPress(ByVal sender As Object, ...
    (microsoft.public.dotnet.general)
  • Re: SetFocus on a Selected textBox in VB6
    ... MAybe there is another way to do this other than SetFocus? ... I have a textBox called txtV24 and a subroutine like below. ... > Private Sub Form_KeyPress ...
    (microsoft.public.vb.controls)
  • Re: Write, Move, Delete text on PictureBox
    ... Public Function WYSIWYG_TextBoxText(TB As TextBox) As String ... Simply place a Label control ... Now, whenever you want create a Label, you would just use ... Err.Raise 10001, "InitializeTextBox Subroutine", _ ...
    (comp.lang.basic.visual.misc)
  • TextBox Control
    ... In looking at the asp.net TextBox, I noticed that there is a property called ... I tried to use this control to call a subroutine called ... The field is the account number. ... TextBox control to post automatically to the server when it's text is ...
    (microsoft.public.dotnet.framework.aspnet)
  • Re: [QUIZ][SOLUTION] Kalah (#58)
    ... preceding URL makes it look harder and more cumbersome than just writing a ... subroutine to exercise your new class. ...
    (comp.lang.ruby)