none
Naming the TextBox RRS feed

  • Question

  • I want to use Controls.GetTextBoxText for some programs, but it requires the TextBox Name, and I don't know what the TextBox Names are, and how do I name the TextBox?
    • Edited by Rohan Pai Thursday, November 4, 2010 6:33 PM Controls.GetTextBoxText would rather be used than what I know how to use, Controls.LastTypedTextBox
    Thursday, November 4, 2010 6:31 PM

Answers

  • The name of the textbox is returned as the result of calling Controls.AddTextBox.

    Here is a simple example.

    'Create a texbox and button = their names are textbox1 and button1
    textbox1 = Controls.AddTextBox(100,100)
    button1 = Controls.AddButton("Enter some text and Press Me",100,200)
    'Start an event that is calleds when a button  is pressed
    Controls.ButtonClicked = OnButtonClicked

    'Button press event subroutine
    Sub OnButtonClicked
      'Check it was the right button
      If (Controls.LastClickedButton = button1) Then
        'get textbox1 text
        textbox1Text = Controls.GetTextBoxText(textbox1)
        'Output it to a simple dialog
        GraphicsWindow.ShowMessage(textbox1Text, "Tetxbox Text")
      EndIf
    EndSub

    • Marked as answer by Rohan Pai Friday, November 5, 2010 3:07 PM
    Thursday, November 4, 2010 7:03 PM
    Moderator
  • if you use txtbox1=Controls.AddTextBox(100,100)

    then txtbox1 is the name of created textbox.

    Now you can use Controls.GetTextBoxTex(txtbox1)

     

    • Marked as answer by Rohan Pai Friday, November 5, 2010 3:07 PM
    Thursday, November 4, 2010 7:05 PM

All replies

  • The name of the textbox is returned as the result of calling Controls.AddTextBox.

    Here is a simple example.

    'Create a texbox and button = their names are textbox1 and button1
    textbox1 = Controls.AddTextBox(100,100)
    button1 = Controls.AddButton("Enter some text and Press Me",100,200)
    'Start an event that is calleds when a button  is pressed
    Controls.ButtonClicked = OnButtonClicked

    'Button press event subroutine
    Sub OnButtonClicked
      'Check it was the right button
      If (Controls.LastClickedButton = button1) Then
        'get textbox1 text
        textbox1Text = Controls.GetTextBoxText(textbox1)
        'Output it to a simple dialog
        GraphicsWindow.ShowMessage(textbox1Text, "Tetxbox Text")
      EndIf
    EndSub

    • Marked as answer by Rohan Pai Friday, November 5, 2010 3:07 PM
    Thursday, November 4, 2010 7:03 PM
    Moderator
  • if you use txtbox1=Controls.AddTextBox(100,100)

    then txtbox1 is the name of created textbox.

    Now you can use Controls.GetTextBoxTex(txtbox1)

     

    • Marked as answer by Rohan Pai Friday, November 5, 2010 3:07 PM
    Thursday, November 4, 2010 7:05 PM
  • Adding a control or shape returns a label, like "Shape1", or "TextBox1" You don't necessarily need a variable. Check out the code below:

    Controls.AddTextBox(100,100)                                                                                                                                                                               Controls.GetTextBoxText("TextBox1")

     


    ~~AirWaves!!~~
    Friday, November 5, 2010 1:42 AM