Results 1 to 28 of 28

Thread: InputBoxes nº of characters limited?

  1. #1

    Thread Starter
    Lively Member
    Join Date
    May 2001
    Location
    Lisbon
    Posts
    122

    Question InputBoxes nº of characters limited?

    Hello my dear friends


    Thas right, that's my question. Is the nº of characters limited on a InputBox?
    In my application I want to put (or should I say Input?) a large sentence but it not allows me to do so.

    Can somebody help me?

    Can I change this?


    Thanks

  2. #2
    Former Admin/Moderator MartinLiss's Avatar
    Join Date
    Sep 1999
    Location
    San Jose, CA
    Posts
    33,431
    I don't know what the input limit is in an InputBox, but I believe it's 32,767 characters in a textbox. I have a form that looks like an InputBox that uses a textbox for the input. If you're interested I'll attach it.

  3. #3

    Thread Starter
    Lively Member
    Join Date
    May 2001
    Location
    Lisbon
    Posts
    122
    Thanks Martin

    Please post your form.


    Thanks

  4. #4

  5. #5

  6. #6

    Thread Starter
    Lively Member
    Join Date
    May 2001
    Location
    Lisbon
    Posts
    122
    Thanks Martin


    I will try to use it instead of a normal InputBox. Later I will tell you the results.

    By the way, one newbie question: whats that InputBox.frx? When I tried to open it, it started Visual FoxPro. What's its function regarding the InputBox.frm?


    Thanks again.

  7. #7
    Former Admin/Moderator MartinLiss's Avatar
    Join Date
    Sep 1999
    Location
    San Jose, CA
    Posts
    33,431
    Some controls have properties that have binary data as their values, such as the Picture property of picture box and image controls or certain properties of custom controls. Visual Basic saves all binary data for a form in a binary data file separate from the form.

    Visual Basic saves the binary data file in the same directory as the form. The binary data file has the same file name as the form, but it has an .frx filename extension. Visual Basic reads the binary data file when loading the form. The binary data file (.frx) must be available to the form when Visual Basic loads it. If you share forms with others that use a binary data file, be sure to provide the binary data file (.frx) as well as the form (.frm).

  8. #8

    Thread Starter
    Lively Member
    Join Date
    May 2001
    Location
    Lisbon
    Posts
    122
    Thanks again Martin

    Your explanation was very helpfull. Since I´ve started using VB that I see those *.frx files and never new the purpose of their existance. Now I know. Allways learnning.

  9. #9

  10. #10

    Thread Starter
    Lively Member
    Join Date
    May 2001
    Location
    Lisbon
    Posts
    122
    Gives me an error "Variable not declared" on

    frmInputBox.Prompt = "This is frmInputBox"

  11. #11

    Thread Starter
    Lively Member
    Join Date
    May 2001
    Location
    Lisbon
    Posts
    122
    Nevermind! I forgot to import InputBox to the Form1 project. Now it works.

    Thanks again

  12. #12

    Thread Starter
    Lively Member
    Join Date
    May 2001
    Location
    Lisbon
    Posts
    122
    Can't make this work.

    On cmdButton of frmInputBox.frm I´ve added the following code (My code is between those two »):

    Private Sub cmdButton_Click(Index As Integer)

    Select Case Index
    Case btnOK
    ButtonClicked = vbOK
    Case btnCancel
    ButtonClicked = vbCancel
    End Select
    »
    If btnOK = 1 Then
    txtInput.Text = Form2.Text1.Text
    End If
    »

    Me.Hide
    Form2.Show
    End Sub


    This must not be 100 % correct 'cause I can .Show Form2 but nothing appears on Form2's TextBox.

    Why?

  13. #13
    Fanatic Member Illspirit's Avatar
    Join Date
    Mar 2001
    Location
    Blackpool, England
    Posts
    815
    if you want the text from 'txtInput' to show up in Form2.Text1.Text, then replace this:

    txtInput.Text = Form2.Text1.Text

    with this

    Code:
    Form2.Text1.Text  = txtInput.Text
    Illspirit - [email protected]

    SmartBarXP Lead Developer
    SmartBarXP - The leading desktop sidebar application for Microsoft Windows XP

  14. #14

    Thread Starter
    Lively Member
    Join Date
    May 2001
    Location
    Lisbon
    Posts
    122
    Illspirit, thanks for your reply.

    It do not work that way. Now I've noticed one thing. The text that I want to "input" can not be a property because the user can put there everything he wants. So, I can not say txtInput.Text.
    Therefore, must be a variable.
    The problem is that I can not find where is it declared.

    By the way: what's the difference between txtInput.Text = Form2.Text1.Text and Form2.Text1.Text = txtInput.Text?

    Can you explain me plain and simple?

  15. #15
    Fanatic Member Illspirit's Avatar
    Join Date
    Mar 2001
    Location
    Blackpool, England
    Posts
    815
    The difference is, the property/variable before the '=' will be set to the property/variable after the '='
    ie.

    A = B - A will be set to B
    B = A - B will be set to A
    Illspirit - [email protected]

    SmartBarXP Lead Developer
    SmartBarXP - The leading desktop sidebar application for Microsoft Windows XP

  16. #16

    Thread Starter
    Lively Member
    Join Date
    May 2001
    Location
    Lisbon
    Posts
    122
    OK, thanks.

    About the rest, can you help me? Have you downloaded the files some replies before?

  17. #17
    Fanatic Member Illspirit's Avatar
    Join Date
    Mar 2001
    Location
    Blackpool, England
    Posts
    815
    Ive downloaded the files...

    Ok, so correct me if i'm wrong:

    What you want to do is set the text in Text1 on Form1 to be what the user has typed in txtInput?

    Have you tried changing that line of code round, like i said before, and it still doesnt work?
    Last edited by Illspirit; Jun 9th, 2001 at 09:27 AM.
    Illspirit - [email protected]

    SmartBarXP Lead Developer
    SmartBarXP - The leading desktop sidebar application for Microsoft Windows XP

  18. #18
    Fanatic Member Illspirit's Avatar
    Join Date
    Mar 2001
    Location
    Blackpool, England
    Posts
    815
    Ahh i see the problem!

    replace this:

    If btnOK = 1 Then

    with this

    Code:
    If ButtonClicked = vbOK Then
    Illspirit - [email protected]

    SmartBarXP Lead Developer
    SmartBarXP - The leading desktop sidebar application for Microsoft Windows XP

  19. #19

    Thread Starter
    Lively Member
    Join Date
    May 2001
    Location
    Lisbon
    Posts
    122
    Ok, I'll try to explain you.

    According with the author of this project, Form1 (frmInputBox) should act like an InputBox (at least I understood it that way).
    Then I've added a Form2 (with a TextBox) to the project.

    So, I want to input text on the InputBox (frmInputBox) and make it appear on Form2.TextBox.

    The property Text of txtInput (on frmInputBox) is something that is constant until you change it in the code and, as you know, you can not change it by simply writting inside the TexBox.

    So, the property Text on frmInputBox's Text Box must be a variable (I think). I can not find any variable declaration for it so that I can use it to make Form2.Text1.Text = ????


    I hope you'll understand this.

  20. #20
    Fanatic Member Illspirit's Avatar
    Join Date
    Mar 2001
    Location
    Blackpool, England
    Posts
    815
    No, you can set a Property at runtime

    Code:
    Form2.Text1.Text = txtInput.Text
    will work
    Illspirit - [email protected]

    SmartBarXP Lead Developer
    SmartBarXP - The leading desktop sidebar application for Microsoft Windows XP

  21. #21

    Thread Starter
    Lively Member
    Join Date
    May 2001
    Location
    Lisbon
    Posts
    122

    Talking

    Now that's OK. It worked, but I had to change this code

    If btnOK = 1 Then
    Form2.Text1.Text = txtInput.Text
    End If

    into this one

    If ButtonClicked = vbOK Then
    Form2.Text1.Text = txtInput.Text
    End If


    Thanks My Friend.

  22. #22
    Fanatic Member Illspirit's Avatar
    Join Date
    Mar 2001
    Location
    Blackpool, England
    Posts
    815
    No problem
    Illspirit - [email protected]

    SmartBarXP Lead Developer
    SmartBarXP - The leading desktop sidebar application for Microsoft Windows XP

  23. #23

  24. #24

    Thread Starter
    Lively Member
    Join Date
    May 2001
    Location
    Lisbon
    Posts
    122
    Hi Martyn

    Yes, it eliminates the problem that stared this thread: the limit on the nº of characters of an InputBox.
    I had some difficulties to put it working, as you can see by my "dialog" with Illspirit but, at the end, everything works fine.
    There's only a "but": I didn't understood the relation between

    Public Property Get ButtonClicked() As Integer

    ButtonClicked = m_intButtonClicked

    End Property



    and



    Private Property Let ButtonClicked(ByVal intButton As Integer)

    m_intButtonClicked = intButton

    End Property


    Why is this needed? Why can't we work only with ButtonClicked = vbOK?
    Sorry about this question but I really need some answers.

    Thanks

  25. #25
    Former Admin/Moderator MartinLiss's Avatar
    Join Date
    Sep 1999
    Location
    San Jose, CA
    Posts
    33,431
    ButtonClicked is one of several properties that I added to the form to make it easy to work with. Here is the list which appears in the form's declaration section.
    Code:
    ' To use this form, you can access its objects directly or through the form's
    ' properties. The following are the properties
     
    '   frmInputBox.ButtonClicked   ' Returns vbOK or vbCancel depending on the button clicked
    '   frmInputBox.Default         ' Returns/sets the initial value for user input
    '   frmInputBox.Display         ' Show the form modally
    '   frmInputBox.PasswordProtect ' Returns/sets whether characters typed by the user are protected
                                    ' by asterisks. (If this is set to True, it doesn't make sense
                                    ' to set the Default property.
    '   frmInputBox.Prompt          ' Set the InputBox Prompt value
    '   frmInputBox.Title           ' Set the InputBox Caption value
    The purpose of the properties are to "hide" the working of a function of the form so that you don't have to worry about the details of how certain things are done and thereby make it easier to work with.

    For example if you want to use my inputbox for the purpose of entering a password, it's a whole lot easier just to say frmInputBox.PasswordProtect = True then to remember that the name of the textbox object on the form is txtInput and to know that the way you password protect the entry of text in a texbox is by setting the textbox's PasswordChar to an asterisk.

    As for your specific question about ButtonClicked, I'm not 100% sure what it is that you are asking. If you are confused about how property procedures work there is a lot of information in Help and/or there are a lot of good VB books that cover the subject. My ButtonClicked property has the Let (the place where the value is set) as Private so that you can't set the "hidden" m_intButtonClicked field directly, but has the Get (the place where you find out what the value is) as Public so that it's available to you by simply saying something like
    Code:
    If frmInputBox.ButtonClicked = vbCancel Then
        MsgBox "Are you sure you want to cancel?"
    End If

  26. #26

    Thread Starter
    Lively Member
    Join Date
    May 2001
    Location
    Lisbon
    Posts
    122
    Thanks, Martin, for your reply.

    I think that you are right when you say that I'm confused about properties procedures. I've started to learn VB about one month ago and I think that, sometimes, I want to know more that I can at this moment.
    I will study a little bit more so that I can understand my own doubts (in this case I feel that I cannot explain you my doubts because I'm confused about it)

    Anyway, thanks a lot for you help. We'll meet again for sure.

  27. #27

  28. #28

    Thread Starter
    Lively Member
    Join Date
    May 2001
    Location
    Lisbon
    Posts
    122
    Nice city, nice country, that's right.

    If you come here, contact me via ICQ.

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