Quantcast
Channel: VBForums
Viewing all articles
Browse latest Browse all 16044

Find an empty textbox on form and populate it with text

$
0
0
Hi All

Hope you and your loved one's are all doing well in these testing times.

I have a form which contains 16 textboxes (form1), on form1 is a button which opens up another form (form 2) (both forms are open at the same time). I scan a barcode into a textbox on form 2, which then splits the reading into other textboxes (lets say one piece of data is the part number which is displayed in txt_part on form2).

On form 2 I have a confirm button and when this is pressed, what I would like the application to do is start from textbox1 on form1, if this is empty then write the value of txt_part on form two to textbox1. If it is not empty then move onto textbox2 and so on. If it reaches textbox 16 and that is also not empty, then an error message will appear i.e. "no empty slots, please clear".

I have some code which is working but it is a lot of if statements checking each box, but I believe a loop will do this and therefore reduce the lines of code required.

Thank you in advance.

Viewing all articles
Browse latest Browse all 16044

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>