Visual Basic Online Course Make Sure All TextBoxes Empty

Visual Basic Online Course

Learn how to
Make sure all Text boxes are clear first

MS VB6 Step-by-step Guide

Step by step guide

Say ......... you have 10 TextBox Controls and 10 ComboBox Controls on a VB6 form and you are taking their contents into a database tables, I guess you have to make sure that all the TextBox Controls and the ComboBox Controls are not empty ... So, you can do something like this ....


'Visual Basic Online Course
'Visual Basic 6
'Make Sure all Text Boxes are Empty / Clear first

Private Sub CMDSAVE_CLICK()
'The button that transfer contents to tables
'if textbox1.text And Textbox2.text and ..... etc then
MsgBox "Leave No Blanks"
exit sub
end if
'Some Codes ............
'Some Codes ............
rs.update 'Or however you connect
 End Sub  
Or, you may use something Like this :-

I will try here to tell the VB project that TxtBx variable represents all the TextBox Controls on a form (Form1) and Cbos variable represents all the ComboBox Controls on the same form .... so the scenario would be:

Hey, Form1 .... Be aware that (TxtBx) represents all my Textbox Controls on You, and (Cbos) represents all my ComboBoex Controls on you, so whenever you find one Empty Just Give me a MsgBox MessageBox and (Exit) the sub . OK?

But If not! Then, continue updating my MS Access database tables .... are we clear, Form1 ??


How could we just Code These Lines of Scenario .......
Here we go :

'Visual Basic Online Course
'Visual Basic 6
'Make sure all textboxes are empty before save

Public Class Form1
Public TxtBx, Cbos As Control
Private Sub BtnSave_Click
For Each TxtBx In Me.Controls
If TypeOf TxtBx Is TextBox And String.IsNullOrEmpty(TxtBx.Text) Then
MsgBox("Leave No Blanks in TextBoxes")
Exit Sub
End If
Next

For Each Cbos In Me.Controls
If TypeOf Cbos Is ComboBox And String.IsNullOrEmpty(Cbos.Text) Then
MsgBox("Leave No Blanks in ComboBoxes")
Exit Sub
End If
Next

For Each Dtp In Me.Controls
If TypeOf Dtp Is MaskedTextBox And String.IsNullOrEmpty(Dtp.Text) Then
MsgBox("Leave No Blanks in Mobile Number")
Exit Sub
End If
Next

rs.addnew
Rs(".............") = TetxBox1.Text
'codes,codes,codes
rs.update
msgbox "Thanks for understanding, Form1"
End Sub
  
Github Gist

Good Luck
_______
---Have Fun---

Visual Basic 6.0 Lessons, Tricks, Tutorials and help links 

Comments

Anonymous said…
I am in fact thankful to the owner of this site who has shared this wonderful paragraph at
at this place.

Here is my webpage ... how to make money
Anonymous said…
I've been exploring for a little for any high-quality articles or weblog posts on this sort of area . Exploring in Yahoo I eventually stumbled upon this web site. Reading this info So i'm
glad to exhibit that I have an incredibly excellent uncanny feeling
I discovered just what I needed. I so much without a doubt will make sure to do not overlook this site and give it a glance on a constant basis.


Here is my site http://www.youtube.com/watch?v=ErFAXQcDoRU
Anonymous said…
It's remarkable to pay a visit this website and reading the views of all mates concerning this paragraph, while I am also zealous of getting knowledge.

My page; how to make free money online
Anonymous said…
Hi to all, how is all, I think every one is getting more from
this web page, and your views are fastidious
designed for new viewers.

Also visit my blog post: home business ideas
Anonymous said…
I think the admin of this web site is really working hard
in favor of his site, because here every material is quality based information.


Here is my webpage ... how to Make money online fast
Anonymous said…
What's up everyone, it's my first pay a quick visit at this
web page, and paragraph is really fruitful in
support of me, keep up posting these articles.


my webpage ... http://www.youtube.com/watch?v=ScFvd7Deva0
Anonymous said…
I just like the valuable information you provide in your
articles. I will bookmark your blog and test once more right here
regularly. I am moderately certain I'll be informed many new stuff proper right here! Best of luck for the next!

my blog - cedar finance reviews
Anonymous said…
It's remarkable to visit this web page and reading the views of all mates regarding this post, while I am also eager of getting knowledge.

Feel free to visit my webpage; how To make money fast online
Anonymous said…
How To make money online fast and free easy no scams Money Online Guaranteed Udemy
Course 100% Free

Video Link: http://ow.ly/LMrzL
Anonymous said…
When I originally commented I clicked the "Notify me when new comments are added" checkbox and
now each time a comment is added I get several e-mails with the same comment.
Is there any way you can remove people from that service?
Cheers!

Have a look at my web-site; WilheminaGDefries
Anonymous said…
Unquestionably consider that which you stated.
Your favorite justification seemed to be at the
internet the easiest thing to have in mind of.

I say to you, I definitely get irked even as people
think about worries that they just do not realize about.

You managed to hit the nail upon the top as well as outlined out
the whole thing without having side-effects , people can take a signal.
Will likely be again to get more. Thank you

Check out my website :: EmilioVHamdn
Anonymous said…
Wow that was odd. I just wrote an really long comment but after I
clicked submit my comment didn't appear. Grrrr...
well I'm not writing all that over again. Anyhow, just wanted to say wonderful blog!


Also visit my weblog - ReaSPointdexter
Anonymous said…
Fabulous, what a web site it is! This webpage provides helpful data
to us, keep it up.

My weblog :: CandanceIDeprince
Anonymous said…
Excellent goods from you, man. I've understand your stuff previous to and
you're just extremely fantastic. I really like
what you've acquired here, really like what you are stating and the way in which you say it.
You make it entertaining and you still take care of to keep
it sensible. I can't wait to read far more from you.
This is actually a wonderful site.

Feel free to visit my website LaquandaCSchachsieck
Anonymous said…
Hello to every body, it's my first pay a visit of this web site;
this blog includes amazing and actually good stuff in support of visitors.


Here is my website; GeraldoNChamers
Anonymous said…
This is really fascinating, You are an excessively
skilled blogger. I have joined your feed and look forward to in search of extra of your great
post. Also, I've shared your web site in my social networks

My website: KieshaESteiner
Anonymous said…
Hmm is anyone else encountering problems with the images on this
blog loading? I'm trying to determine if its a problem on my end or if it's the blog.
Any suggestions would be greatly appreciated.

Check out my web site CheryleSSandoual
Anonymous said…
Aw, this was a really good post. Taking the time and actual effort to generate a very good article… but what can I say… I
put things off a lot and never seem to get anything done.



Stop by my web-site: EleanoreQGluck
Anonymous said…
Howdy, i read your blog from time to time and i own a
similar one and i was just curious if you get a lot of spam
remarks? If so how do you prevent it, any plugin or
anything you can recommend? I get so much lately it's driving me mad so
any help is very much appreciated.

My weblog SybilSLiquet
Anonymous said…
It's a pity you don't have a donate button! I'd most certainly donate to
this brilliant blog! I suppose for now i'll settle for book-marking and adding your RSS feed to my Google account.
I look forward to new updates and will talk about this website
with my Facebook group. Talk soon!

my blog: CristiAMaroney
Anonymous said…
Today, I went to the beachfront with my children. I found a sea shell and gave it
to my 4 year old daughter and said "You can hear the ocean if you put this to your ear." She
put the shell to her ear and screamed. There was a hermit crab inside and it pinched her
ear. She never wants to go back! LoL I know this is entirely off topic but I had to tell someone!


Feel free to visit my web page :: CedrickNDescamps

VB6 Popular Posts

Visual Basic Online Course - Excel 2003 Part 1

VB 6.0 - Save/Retrieve Images From Access Database

Visual Basic Online Course - ProgressBar Colors

VB 6.0 with MS-Access 2003 Copy a record from table to another

Free download Visual Basic 6 Documentation MSDN

Visual Basic Online Course - Run-time error '3021' : Either BOF or EOF is True, or the current record has been deleted.

Visual Basic Online Course - Create a Phone Book

VB6 Crystal Reports 4.6 Error : Method 'Action' of object 'CrystalCtrl' Failed

Visual Basic Online Course - Excel 2003 Part 2