Go Back  Xtreme Visual Basic Talk > Legacy Visual Basic (VB 4/5/6) > Communications > Mscomm.portopen Problems


Reply
 
Thread Tools Display Modes
  #1  
Old 06-12-2005, 03:10 PM
aureliuh aureliuh is offline
Newcomer
 
Join Date: Apr 2005
Posts: 7
Default Mscomm.portopen Problems


HI THERE! i AM TRYING TO MAKE A PROGRAM THAT COMUNICATE WITH MY CELL PHONE AND NOW i HAVE A BIG PROBLEM AND i DO NOT KNOW WHY!

I PUT 2 RADIO BUTTONS ON A FORM ( COM1 AND COM2) AND YOU HAVE TO SELECT THE ONE THAT CORESPONDS TO THE PORT TO WHICH THE DEVICE IS CONNECTED. wHEN YOU SELECT THE COM2 THE PROGRAM STOPS AND IT REPORTS THE NEXT MESSAGE APROX: tHE PORT IS NOT OPEND

tHE CODE IS BELOW
Code:
If com.PortOpen Then com.PortOpen = False End If com.CommPort = c com.Settings = "19200,N,8,1" com.PortOpen = True com.Output = "ATE0" & Chr(13) Do DoEvents Buffer = Buffer & com.Input Loop Until InStr(Buffer, "OK" & vcrlf) Buffer = "" com.Output = "AT+CGMI" & Chr(13) Do DoEvents Buffer = Buffer & com.Input Loop Until InStr(Buffer, "OK" & vcrlf) Size = Len(Buffer) j = Size Label1.Caption = "" For i = 1 To Size Step 1 caracter = Right(Buffer, j) car = Left(caracter, 1) If car = vbCr Then End If If car <> vbCr And car <> vbLf And car <> vbCrLf Then final = final & car End If j = j - 1 Next i pozitie = InStr(final, "OK") device = Left(final, Len(final) - 2) Label1.Caption = device If device <> "" Then Shape1.BackColor = &HFF00& End If
PLEASE HELP MEEE!

Last edited by BillSoo; 06-13-2005 at 05:06 AM. Reason: added vb tags
Reply With Quote
  #2  
Old 06-13-2005, 05:08 AM
BillSoo's Avatar
BillSoo BillSoo is offline
Code Meister

Retired Moderator
* Guru *
 
Join Date: Aug 2000
Location: Vancouver, BC, Canada
Posts: 10,441
Default

Perhaps the COM port is already being used by something? VB cannot open a port that is in use by another application.
__________________
"I have a plan so cunning you could put a tail on it and call it a weasel!" - Edmund Blackadder
Reply With Quote
  #3  
Old 06-13-2005, 05:52 AM
aureliuh aureliuh is offline
Newcomer
 
Join Date: Apr 2005
Posts: 7
Default

No other app is using the com ports !! And If it was so it should report that the comport is open not that the com port was not opened
Reply With Quote
Reply


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Forum Jump

Advertisement:





Free Publications
The ASP.NET 2.0 Anthology
101 Essential Tips, Tricks & Hacks - Free 156 Page Preview. Learn the most practical features and best approaches for ASP.NET.
subscribe
Programmers Heaven C# School Book -Free 338 Page eBook
The Programmers Heaven C# School book covers the .NET framework and the C# language.
subscribe
Build Your Own ASP.NET 3.5 Web Site Using C# & VB, 3rd Edition - Free 219 Page Preview!
This comprehensive step-by-step guide will help get your database-driven ASP.NET web site up and running in no time..
subscribe
 
 
-->