borderAndreaVB free resources for Visual Basic developersborder

borderAndreaVB Visual Basic and VB.NET source code resources - Copyright © 1999-2007 Andrea Tincaniborder

AndreaVB | Forum | News | Downloads | Register | Help | Member List | Statistics | Search | PM | Profile

Print This Topic
Previous Topic (Need Documentation Help)Next Topic (Formatting Output) New Topic New Poll Post Reply
AndreaVB Forum : VB General : TextBox & 4-next loop
Poster Message
Zooker
Level: Professor

Registered: 28-05-2003
Posts: 89

icon TextBox & 4-next loop

How can I get info into a 4 next loop.  I have 20 questions that a user must input, I tried using 20 Text Boxes but that was a Nite Mare. Visual Basic is so very limited in input options.
I Tried something like this but never could get it to work!

Sub Text1-Change
For X%=1 to 20
  Form 1. Print question Number X%
    Cnf(X%)=Text1.text
Next X%
end sub
It never worked ! Why, How could i do that?

____________________________
It took me 73 years to get this stupid!

30-10-2004 at 03:12 AM
View Profile Send Email to User Show All Posts | Quote Reply
Goran
Level: Moderator

Registered: 16-05-2002
Posts: 1681
icon Re: TextBox & 4-next loop

If you put only 1 textbox, and ask from user to type all answers in it, then it can be very confusing for the user, since user cannot know what answers he gave, nor can he change them. If you create a control array of 20 textboxes, then it could be quite easy to get all the answers

private sub text1_change(index as integer)
    cnf(index)=text1(index).text
end sub


In your array base index starts with 1, then you should change it to

private sub text1_change(index as integer)
    cnf(index)=text1(index+1).text
end sub


____________________________
If you find the answer helpful, please mark this topic as solved.

30-10-2004 at 10:38 AM
View Profile Send Email to User Show All Posts | Quote Reply
Zooker
Level: Professor

Registered: 28-05-2003
Posts: 89
icon Re: TextBox & 4-next loop

Didn't Work, I needed 20 Boxes. I want to know How I can Just use ONE text box for 20 different entries on One Form.  I don't care about programing elegance or use niceties. I need this program for my OWN Personal use!

____________________________
It took me 73 years to get this stupid!

31-10-2004 at 06:26 AM
View Profile Send Email to User Show All Posts | Quote Reply
Goran
Level: Moderator

Registered: 16-05-2002
Posts: 1681
icon Re: TextBox & 4-next loop

Try this, it can do the work. Place Textbox and Label on the form

Dim cnf(20) As String

Private Sub Text1_KeyPress(KeyAscii As Integer)
Static x As Integer

    If KeyAscii = 13 Then
        x = x + 1
        cnf(x) = Text1.Text
        Text1.Text = ""
        SetLabelCaption x
    End If
End Sub


SetLabelCaption can be a function where you will change label caption. It can look like this

private sub SetLabelCaption(x as integer)
    select case x
        case 1
            label1.caption="First question"
        case 2
            label1.caption="second question"
        ' etc etc etc
    end select
end sub


____________________________
If you find the answer helpful, please mark this topic as solved.

31-10-2004 at 05:29 PM
View Profile Send Email to User Show All Posts | Quote Reply
Zooker
Level: Professor

Registered: 28-05-2003
Posts: 89
icon Re: TextBox & 4-next loop

Thanks I'll try It!!

____________________________
It took me 73 years to get this stupid!

01-11-2004 at 05:59 AM
View Profile Send Email to User Show All Posts | Quote Reply
Zooker
Level: Professor

Registered: 28-05-2003
Posts: 89
icon Re: TextBox & 4-next loop

I have some strange goings on in my machine.  Some parts of my program don't work correctly. I have been getting a RUNDLL Error message, Error loading wf2kcpl.dll,invalid Access to Memory location when I boot. Could this cause an out of stack space at a Text12.Setfocus command?



____________________________
It took me 73 years to get this stupid!

02-11-2004 at 04:44 PM
View Profile Send Email to User Show All Posts | Quote Reply
Goran
Level: Moderator

Registered: 16-05-2002
Posts: 1681
icon Re: TextBox & 4-next loop

I dont understand what this has to do with program you are making? Did you put it in startup? This file is is loading default settings for Leadtek Winfast graphics cards, but it seems it is not system critical. If you installed some serice pack, or something else that caused your graphics driver not to work correctly,  then try installing graphics driver again.

____________________________
If you find the answer helpful, please mark this topic as solved.

02-11-2004 at 07:55 PM
View Profile Send Email to User Show All Posts | Quote Reply
nappel
Level: Protégé

Registered: 06-12-2004
Posts: 6
icon Re: TextBox & 4-next loop

See examples http://www.oflameron.ru/ebook.htm


____________________________
http://word.oflameron.ru

06-12-2004 at 11:42 AM
View Profile Send Email to User Show All Posts Visit Homepage | Quote Reply
AndreaVB Forum : VB General : TextBox & 4-next loop
Previous Topic (Need Documentation Help)Next Topic (Formatting Output) New Topic New Poll Post Reply
Surf To:


Not Logged In? Username: Password: Lost your password?
Partners: Download Actual Software | Free Software Download
borderAndreaVB free resources for Visual Basic developersborder

borderAndreaVB Visual Basic and VB.NET source code resources - Copyright © 1999-2007 Andrea Tincaniborder