Results 1 to 6 of 6

Thread: TabControl problem...please help. :(

  1. #1

    Thread Starter
    New Member
    Join Date
    Oct 2002
    Posts
    3

    Lightbulb TabControl problem...please help. :(

    Okay...this is driving me crazy. I have a text box named txtDisplay in a Tab Control named TabControl1 on page 2 named Tab2.

    How do I reference it correctly from the code???

    I keep getting a "Index and length must refer to a location within the string." error.

    This is the code I'm currently using..


    Private Sub DisplayText(ByVal t As String)
    txtDisplay.AppendText(t)
    End Sub


    If I move the text box off of the tab control it works...

    How do I properly reference the text box??

    Thanks in advance!

    Clif

  2. #2
    Your Ad Here! Edneeis's Avatar
    Join Date
    Feb 2000
    Location
    Moreno Valley, CA (SoCal)
    Posts
    7,339
    That works fine for me, maybe its something else. How are you adding the textbox to the tabpage? I assume just drag and drop. Wierd.

  3. #3

    Thread Starter
    New Member
    Join Date
    Oct 2002
    Posts
    3
    Yes...drag and drop.

    I'm using the Microsoft example of using chat in with tcp sockets. Works like a charm if I drag it off the tab page...broke when I drag it back on.

    Thanks for the reply.

    If anyone can help me...I need it!

    Thanks,
    Clif

  4. #4
    Your Ad Here! Edneeis's Avatar
    Join Date
    Feb 2000
    Location
    Moreno Valley, CA (SoCal)
    Posts
    7,339
    Maybe it just removed the Handles blah blah event info for any events you were using. Sometimes the IDE does that if you move or cut and paste controls. So if the error message doesn't directly relate to the control then maybe it is a logic error caused by event code not firing.

  5. #5

    Thread Starter
    New Member
    Join Date
    Oct 2002
    Posts
    3
    It compiles fine...upon execution it throws this message though...

    System.ArgumentOutOfRangeException: Index and length must refer to a location within the string.
    Parameter name: length
    at System.String.Substring(Int32 startIndex, Int32 length)
    at System.Windows.Forms.TextBoxBase.set_SelectedText(String value)
    at System.Windows.Forms.TextBoxBase.AppendText(String text)
    at Klip.Form1.DisplayText(String t) in C:\Documents and Settings\Clifton Griffin\My Documents\Visual Studio Projects\Klip\Form1.vb:line 423
    at Klip.Form1.Form1_Load(Object sender, EventArgs e) in C:\Documents and Settings\Clifton Griffin\My Documents\Visual Studio Projects\Klip\Form1.vb:line 368
    at System.Windows.Forms.Form.OnLoad(EventArgs e)
    at System.Windows.Forms.Form.OnCreateControl()
    at System.Windows.Forms.Control.CreateControl(Boolean fIgnoreVisible)
    at System.Windows.Forms.Control.CreateControl()
    at System.Windows.Forms.Control.WmShowWindow(Message& m)
    at System.Windows.Forms.Control.WndProc(Message& m)
    at System.Windows.Forms.ScrollableControl.WndProc(Message& m)
    at System.Windows.Forms.ContainerControl.WndProc(Message& m)
    at System.Windows.Forms.Form.WmShowWindow(Message& m)
    at System.Windows.Forms.Form.WndProc(Message& m)
    at System.Windows.Forms.ControlNativeWindow.OnMessage(Message& m)
    at System.Windows.Forms.ControlNativeWindow.WndProc(Message& m)
    at System.Windows.Forms.NativeWindow.Callback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)


    ************** Loaded Assemblies **************
    mscorlib
    Assembly Version: 1.0.3300.0
    Win32 Version: 1.0.3705.0
    CodeBase: file:///c:/windows/microsoft.net/framework/v1.0.3705/mscorlib.dll
    ----------------------------------------
    Klip
    Assembly Version: 1.0.1020.17865
    Win32 Version: 1.0.1020.17865
    CodeBase: file:///C:/Documents%20and%20Settings/Clifton%20Griffin/My%20Documents/Visual%20Studio%20Projects/Klip/bin/Klip.exe
    ----------------------------------------
    System.Windows.Forms
    Assembly Version: 1.0.3300.0
    Win32 Version: 1.0.3617.0
    CodeBase: file:///c:/windows/assembly/gac/system.windows.forms/1.0.3300.0__b77a5c561934e089/system.windows.forms.dll
    ----------------------------------------
    System
    Assembly Version: 1.0.3300.0
    Win32 Version: 1.0.3617.0
    CodeBase: file:///c:/windows/assembly/gac/system/1.0.3300.0__b77a5c561934e089/system.dll
    ----------------------------------------
    System.Drawing
    Assembly Version: 1.0.3300.0
    Win32 Version: 1.0.3617.0
    CodeBase: file:///c:/windows/assembly/gac/system.drawing/1.0.3300.0__b03f5f7f11d50a3a/system.drawing.dll
    ----------------------------------------
    System.Xml
    Assembly Version: 1.0.3300.0
    Win32 Version: 1.0.3617.0
    CodeBase: file:///c:/windows/assembly/gac/system.xml/1.0.3300.0__b77a5c561934e089/system.xml.dll
    ----------------------------------------
    Accessibility
    Assembly Version: 1.0.3300.0
    Win32 Version: 1.0.3617.0
    CodeBase: file:///c:/windows/assembly/gac/accessibility/1.0.3300.0__b03f5f7f11d50a3a/accessibility.dll
    ----------------------------------------
    Microsoft.VisualBasic
    Assembly Version: 7.0.3300.0
    Win32 Version: 7.00.9447
    CodeBase: file:///c:/windows/assembly/gac/microsoft.visualbasic/7.0.3300.0__b03f5f7f11d50a3a/microsoft.visualbasic.dll
    Does this change your diagnosis...and what would I do to restore the handles?

    Thanks!

    Clif

  6. #6
    Your Ad Here! Edneeis's Avatar
    Join Date
    Feb 2000
    Location
    Moreno Valley, CA (SoCal)
    Posts
    7,339
    Check either of these lines:
    Klip.Form1.DisplayText(String t) in C:\Documents and Settings\Clifton Griffin\My Documents\Visual Studio Projects\Klip\Form1.vb:line 423

    Klip.Form1.Form1_Load(Object sender, EventArgs e) in C:\Documents and Settings\Clifton Griffin\My Documents\Visual Studio Projects\Klip\Form1.vb:line 368

    The Handles bit may be nothing, it really depends on what the code is suppose to do. It seems like the textbox is suppose to have text in it and doesn't or if the length of the text is wrong or something.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width