Msg Box help again PLEASE I am new to programming 
Author Message
 Msg Box help again PLEASE I am new to programming

hello:
I am making a program to analyze a loan. The first txtprincipal.text is
for the principal.  If I tb to the next box and that box is empty I
would like a message to say you left this blank and have the focus go
back to the blank text box.  If the data is entered in the box than I
can just go merrily on my way.

Can someone expalin why I can't get the hang of this message box.
Lorrin gave me an example of an array but that is to far beyond me at
this point I don't have a clue on how to set that up. "KISS" It appears
I am not very bright in this matter so please keep it simple for me.

Thanks
Ken Fair
Orlando, Fl



Mon, 04 Dec 2000 03:00:00 GMT  
 Msg Box help again PLEASE I am new to programming

It's very simple.
Suppose you have your text box (named Textbox1 in your form) and you want
this field to be filled in.
You have to code a sub like this

Private Sub Textbox1_LostFocus()
    If  Textbox1.Text = vbNullString  then
        Msgbox "Hey you missed something",vbInformation
        Textbox1.setfocus
    End If
End Sub

Notice that vbNullString is a VB constant that stay for ""
It's so simple.

Bye.

Kenneth W. Fair ha scritto:

Quote:
> hello:
> I am making a program to analyze a loan. The first txtprincipal.text is
> for the principal.  If I tb to the next box and that box is empty I
> would like a message to say you left this blank and have the focus go
> back to the blank text box.  If the data is entered in the box than I
> can just go merrily on my way.

> Can someone expalin why I can't get the hang of this message box.
> Lorrin gave me an example of an array but that is to far beyond me at
> this point I don't have a clue on how to set that up. "KISS" It appears
> I am not very bright in this matter so please keep it simple for me.

> Thanks
> Ken Fair
> Orlando, Fl


  vcard.vcf
< 1K Download


Mon, 04 Dec 2000 03:00:00 GMT  
 Msg Box help again PLEASE I am new to programming

The third example worked with your existing textboxes.  If you read the
earlier post that was explained.  I apologize for some of my rudeness,
although I do not know your programming level.  So if you can follow the
next set of instructions I do not think it can get much simpler or you will
need to by a beginning programming book to learn these simple techniques.

Private Sub txtPrincipal_LostFocus ()

If txtprincipal.Text = "" Then
    MsgBox "Please Input the Loans Principal Amount"
    txtprincipal.SetFocus
End If

End Sub

Paste this code into your forms code window.  Then post it for every text
box you want checked and just change the name from txtprincipal to what ever
the name of the text box is.  I do not think has any thing to do with
brightness, it has to do with knowledge.

HTH,
Lorrin L. Williams
Karma Komputing
"The Unexamined Life is not worth Living" - Socrates

Quote:

>hello:
>I am making a program to analyze a loan. The first txtprincipal.text is
>for the principal.  If I tb to the next box and that box is empty I
>would like a message to say you left this blank and have the focus go
>back to the blank text box.  If the data is entered in the box than I
>can just go merrily on my way.

>Can someone expalin why I can't get the hang of this message box.
>Lorrin gave me an example of an array but that is to far beyond me at
>this point I don't have a clue on how to set that up. "KISS" It appears
>I am not very bright in this matter so please keep it simple for me.

>Thanks
>Ken Fair
>Orlando, Fl




Mon, 04 Dec 2000 03:00:00 GMT  
 Msg Box help again PLEASE I am new to programming

<cut>

Quote:
>    If  Textbox1.Text = vbNullString  then
<cut>
>Notice that vbNullString is a VB constant that stay for ""
>It's so simple.

<cut>

vbNullString is not an empty string...  it is a null pointer that VB treats
as if it were a valid string reference.  The code above works because of the
way VB coerces the data for the comparison but I'd avoid it since you are
asking for problems when you upgrade VB.  This may or may not work in future
revs.  To test if a textbox is empty you should use:
    If Trim$(Text1.Text)="" Then
or:
    If Len(Trim$(Text1.Text))=0 Then

The vbNullString constant is used when you have an external DLL call
(usually a Windows API call) that takes either a string or NULL and you want
to be able to pass NULL without having to use "As Any" in the Declare.
Don't use it for anything else.



Mon, 04 Dec 2000 03:00:00 GMT  
 
 [ 4 post ] 

 Relevant Pages 

1. help again please:error msg doesn't work

2. Please help, I am new to Jet Engine and SQL

3. I am new, Please help me

4. Validation of fileds Please Help I am new.

5. Please Help I am New at this (VB5)

6. PLEASE HELP, PLEASE HELP, PLEASE HELP, PLEASE HELP, PLEASE HELP, PLEASE HELP, PLEASE HELP,

7. Help I am stumped again.

8. Help I am stumped again.

9. Hello, i am new at programming..

10. Please, please help, I am desperated...:(

11. PLEASE, PLEASE HELP, am I going MAD - Generating Totals

12. Please Help with file .msg (Outlook file)

 

 
Powered by phpBB® Forum Software