NewBie -- Textbox Control

M

Martijn

Hi,

My teacher gave me this assignment, make a form with five textboxes, write
an function that looks if the textbox holds some information if so goto the
next textbox, if this textbox doesn't hold any information remember that.
Goto the next textbox to see if it holds information if so place this
information into the textbox that didn't hold any information...and so an.
Anybody have a idea??

I already come up with this code but did only shows whenever a textbox is
empty or not

Sub Check(ByVal ctl As Control)
For Each ctl In Me.Controls
If (TypeOf ctl Is TextBox) Then
If ctl.Text.Length <> 0 Then
MsgBox("This field holds information")
Else

MsgBox("This field is empty")

End If
End If
Next
End Sub

Hopefully someone can help me
 
J

JohnK

THINK!
We are not here to resolve your schoolwork.

Second: (ten tweede dus): do not and *never* use your real e-mail address in
newsgroups. Spam will be the result!

Ja, Martijn, zo werkt het dus.
 
H

Herfried K. Wagner [MVP]

* "Martijn said:
My teacher gave me this assignment, make a form with five textboxes, write
an function that looks if the textbox holds some information if so goto the
next textbox, if this textbox doesn't hold any information remember that.
Goto the next textbox to see if it holds information if so place this
information into the textbox that didn't hold any information...and so an.
Anybody have a idea??

Add the textboxes to an 'ArrayList' if they hold information.
 
M

Martijn

....de vraag die ik stelde is niet voor school. Ben nieuw in programmeren en
een collega (iemand met 15 jaar programmeer kennis) vroeg of ik dit kon
maken en dan gebruik maken van recurse functies. Misschien dat je me nu wilt
helpen...of weet je het antwoord niet...??
 
H

Herfried K. Wagner [MVP]

* "Martijn said:
alright, am going to try it

If you have any further questions, feel free to ask them here, but
remember that we won't do your homework.
 
M

Martijn

Sorry, for the wrong information...it isn't for school. A
co-worker(somebody with serveral years of programming knowledge) came with
this assignment. Am new to programming and trying to solve this issue. The
only thing he said was that if have to use recurse statements. It don't
expect from you to give me the full script...but could you give some
advice...??

thanx
 
H

Herfried K. Wagner [MVP]

* "Martijn said:
Sorry, for the wrong information...it isn't for school. A
co-worker(somebody with serveral years of programming knowledge) came with
this assignment. Am new to programming and trying to solve this issue. The
only thing he said was that if have to use recurse statements. It don't
expect from you to give me the full script...but could you give some
advice...??

\\\
Private m_NonEmptyTextBoxes As New ArrayList()
..
..
..

' Inside your recursive sub.
If <textbox 'txt' is not empty> Then
m_NonEmptyTextBoxes.Add(txt)
End If
///
 
M

Martijn

This is what I came up with so far...

Sub check(ByVal ctl As Control)

For Each ctl In Me.Controls
If TypeOf ctl Is TextBox Then
If ctl.Text.Length = 0 Then
MsgBox(ctl.Name)
Else
MsgBox("This field is filled")
End If
End If
Next

End Sub

Private Sub TextBox2_TextChanged(ByVal sender As System.Object, ByVal e
As System.EventArgs) Handles TextBox2.Leave
check(Me.TextBox2)
End Sub

This shows me which fields holds values and which not. Now if textbox1 is
filled and textbox2 is not, how do I put the value of textbox3 into
textbox2. what I want is to move every vaule one place up. but only if a
textbox has no value.

by the way...thank you for your help.
 
J

JohnK

(In English): Sorry Martijn, but the way you put the question suggested you
are a student. By the way, I have more than 25 years of programming
experience. The answer given in the rst of this thread may help you, so I'm
not jumpin in any further.

Groet
John
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top