Please..I dont know what the problem is..
Please..I dont know what the problem is..
Please..I dont know what the problem is..
Please..I dont know what the problem is..
Please..I dont know what the problem is..
Please..I dont know what the problem is.. Please..I dont know what the problem is.. Please..I dont know what the problem is.. Please..I dont know what the problem is.. Please..I dont know what the problem is.. Please..I dont know what the problem is.. Please..I dont know what the problem is.. Please..I dont know what the problem is..
Please..I dont know what the problem is.. Please..I dont know what the problem is..
Please..I dont know what the problem is..
Go Back  Xtreme Visual Basic Talk > > > Please..I dont know what the problem is..


Reply
 
Thread Tools Display Modes
  #1  
Old 05-25-2005, 08:01 PM
arymas arymas is offline
Newcomer
 
Join Date: Dec 2003
Posts: 23
Unhappy Please..I dont know what the problem is..


Here code I got from internet. It doesnt work when I run it. Nothing happen when I press keyboard. Please..

Option Explicit
Private Sub Form_Load()
MSComm1.CommPort = 1
MSComm1.Settings = "9600,n,8,1"
MSComm1.InputLen = 0
MSComm1.PortOpen = True
End Sub

Private Sub Form_KeyPress(KeyAscii As Integer)
MSComm1.Output = KeyAscii
Text1.Text = KeyAscii
End Sub

Private Sub MSComm1_OnComm()
If (MSComm1.CommEvent = comEvReceive) Then
Text2.Text = MSComm1.Input
End If
End Sub

Private Sub Command1_Click()
End
End Sub
Reply With Quote
  #2  
Old 05-26-2005, 02:11 AM
webbone's Avatar
webbone webbone is offline
Hydrogen Powered

Administrator
* Expert *
 
Join Date: Jul 2003
Location: Sacramento, CA
Posts: 6,090
Default

Are you expecting something to happen when you press a key? Why would you say the code "doesn't work" if you just "got it on the internet"?

The code you have posted SHOULD be putting something into your Text1 textbox assuming you have placed such a control onto your form. Beyond that it is using the serial port - which would presume you have the serial port connected to something that knows what to do with the data you send.

If you want to learn about serial communications techniques in VB you should check out the links in the FAQ at the top of the communications forum here: http://www.xtremevbtalk.com/communications/37689-frequently-communication-questions.html

Also, you might want to review the Posting Guidelines - the forum is designed to work best when you create your own code and then ask for specific help with specific problems you may be having.
__________________
"With the appearance of the AddressOf operator, an entire industry has developed among authors illustrating how to do previously impossible tasks using Visual Basic. Another industry is rapidly developing among consultants helping users who have gotten into trouble attempting these tasks." -Dan Appleman
Reply With Quote
  #3  
Old 05-26-2005, 07:25 PM
arymas arymas is offline
Newcomer
 
Join Date: Dec 2003
Posts: 23
Default

Thank you. Yes, after I run it and write into text1 (this one is ok), it should be write into text2 automatically (as told in the note). But it doesnt work like that. Seems like the MSComm1.CommEvent did not receive anything. Or should I connect pin 2 and 3 at the serial port communication? I dont think so that I should connect to the hardware because I tried on pooling method and it is ok but it need to connect pin 2 and 3.
Reply With Quote
  #4  
Old 05-26-2005, 07:44 PM
webbone's Avatar
webbone webbone is offline
Hydrogen Powered

Administrator
* Expert *
 
Join Date: Jul 2003
Location: Sacramento, CA
Posts: 6,090
Default

You refer to a note that told you the data would magically appear in text2? Did the note explain what the program does, how it works, and if perhaps there are any requirements for running it besides VB?? Again, if you want to learn how to utilize communications programming techniques in VB I'd strongly advise against just picking up code from on the web rather than actually writing your own by understanding the controls and methods involved. Check out the FAQ I mentioned and you will go far!

If you want to loop back your serial output to your serial input, then connecting pin 2 to pin 3 on the serial port will do that.
__________________
"With the appearance of the AddressOf operator, an entire industry has developed among authors illustrating how to do previously impossible tasks using Visual Basic. Another industry is rapidly developing among consultants helping users who have gotten into trouble attempting these tasks." -Dan Appleman
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
Please..I dont know what the problem is..
Please..I dont know what the problem is..
Please..I dont know what the problem is.. Please..I dont know what the problem is..
Please..I dont know what the problem is..
Please..I dont know what the problem is..
Please..I dont know what the problem is.. Please..I dont know what the problem is.. Please..I dont know what the problem is.. Please..I dont know what the problem is.. Please..I dont know what the problem is.. Please..I dont know what the problem is.. Please..I dont know what the problem is..
Please..I dont know what the problem is..
Please..I dont know what the problem is..
 
Please..I dont know what the problem is..
Please..I dont know what the problem is..
 
-->