Question VB FORM in WAITING mode, serial port communication

vishalkbhatt

Member
Joined
Oct 7, 2010
Messages
12
Programming Experience
Beginner
Hi friends..I m working on an application on serial port communication with PLC machine. Now this communication is only done with one PLC at a time. So I m sending a query to PLC and untill its responds back the application goes into wait mode. i.e. no other operations can be done, and an hourglass cursor shud be displayed with all other components locked on the form. So how do I achieve this using vb.net?? thanks
 

Budius

Well-known member
Joined
Aug 6, 2010
Messages
137
Location
UK
Programming Experience
3-5
Use the serial port class.
Me.Cursor = Cursors.WaitCursor
''' process whatever you need
Me.Cursor = Cursors.Default

if you need more specific answers you should ask more specific question.
 

vishalkbhatt

Member
Joined
Oct 7, 2010
Messages
12
Programming Experience
Beginner
Thnks Budius for reply.. I think my question was quite specific that the application should not be accessible (i.e. No controls can be accessed) until it gets any reply from PLC. till then it only shows the waitcursor. I hope now my question is clearer than b4.
 

Budius

Well-known member
Joined
Aug 6, 2010
Messages
137
Location
UK
Programming Experience
3-5
so I guess what you looking for is to disable the controls in a form.

you can do it one by one:
Which might be cool cause you know exactly which ones you're disabling.
VB.NET:
Button1.Enable = False
Button2.Enable = False
TextBox1.Enable = False
etc....

or use all automatic (use it with cautions)
VB.NET:
        For Each Ctr As Control In Me.Controls
            Ctr.Enabled = False
        Next

I just strongly suggest you to be careful while locking your application like this.
Make sure to have time-outs or you can get some seriously unstable application.

happy coding,
 
Top Bottom