Blank textbox shows message

lucky12341

Board Regular
Joined
Nov 4, 2005
Messages
121
I am working on a school project and am new to the computer sciences field and VB.Net. I almost have completed this assignment but I cannot seem to figure something out after doing alot of research and attempting the problem for awhile.

I need my userform to check to make sure the text box (nametxt) is not blank whenever a user does anything. If anyone needs example of my code let me know, I just cannot get a msgbox to show when the text box is blank.
 

Excel Facts

Pivot Table Drill Down
Double-click any number in a pivot table to create a new report showing all detail rows that make up that number
Why not just test for it:

<font face=Tahoma><SPAN style="color:#00007F">Private</SPAN> <SPAN style="color:#00007F">Sub</SPAN> nametxt_Exit(<SPAN style="color:#00007F">ByVal</SPAN> Cancel <SPAN style="color:#00007F">As</SPAN> MSForms.ReturnBoolean)
    <SPAN style="color:#00007F">If</SPAN> nametxt.Text = "" <SPAN style="color:#00007F">Then</SPAN>
        MsgBox "Name must be filled in"
        nametxt.SetFocus
    <SPAN style="color:#00007F">End</SPAN> <SPAN style="color:#00007F">If</SPAN>
<SPAN style="color:#00007F">End</SPAN> <SPAN style="color:#00007F">Sub</SPAN></FONT>

I used the Exit event in case someone tries to tab through it, but that may not be the trigger you want.

HTH,

Smitty
 
Upvote 0
Well I need the user to be able to fiddle with anything on the userform. Specifically though when they click on one of the radiobuttons that is supposed to display something, I want it to make sure the nametxt textbox is not blank. I didnt know if there was a general way I can do this or if I have to link it to each of the 4 radio buttons etc.

I apologize I know its a retarded and sinple school project but I love programming and I get frustrated becuase I haven't found a way to mutate the code yet.

UPDATE- I got it working, thank you very much for the help.
 
Upvote 0

Forum statistics

Threads
1,214,827
Messages
6,121,821
Members
449,049
Latest member
cybersurfer5000

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top