|
Sorry, back to your last advice. This fills the combobox, but it is not linked to the Scores table. So if I hit the next button, I can step through the table, but the combobox will not reflect the correct student, it will stay with the first name.
|
|
|
|
|
Well if I understand you correctly, you need to handle the click event of the next button and then select the correct item in the ComboBox using: ComboBox.selectedValue = StudentID
|
|
|
|
|
What use to happen in VB6 is that you just add the following in the click event
bm_TestScores += 1
This causes you to move the row value up. Currently I use this to update the text values.
If I use the same "binding" for the combobox as for the textbox, the combobox update with the textbox when I hit the "next" button. Problem is it then shows the studentID and not the FirstName.
|
|
|
|
|
Hi,
How to invoke a .Net dll from vb script. While creating the object it is giving the Automation error. My OS is 2000 with .Net framework 1.1. The same script is working on another machine(configuration 2003R2 .Net framework 3.5).
Regards, Subramanyeswari
modified on Wednesday, February 4, 2009 1:06 AM
|
|
|
|
|
What do you mean by 'invoke' ? Are you trying to run it through COM ? What version of .NET was the dll written with ?
Christian Graus
Driven to the arms of OSX by Vista.
|
|
|
|
|
the .Net dll i think it is written in .Net 1.1. Invoke means when i am instantiating class I am getting the error.
Wscript.createobject("NetClass.cls").. here it is failing. it is giving "could not create object" error.
Regards
|
|
|
|
|
Your .NET component isn't registered as a COM server. You need to use the RegAsm tool to do that. You'll find that somewhere under C:\Windows\Microsoft.NET\Framework. Just search for RegAsm.exe and you'll find it.
|
|
|
|
|
hey, i tried a new way to trap the enter key press event, so it dose not matter what control on the form has focus the enter key will be trapped, can someone correct me please
<pre>Private Shadows Sub KeyPress(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyPressEventArgs) Handles MyBase.KeyPress
If Asc(e.KeyChar) = Keys.Enter Then
MsgBox("YES!")
e.Handled = True
End If
End Sub</pre>
J.Hardy
|
|
|
|
|
Hi,
you should use the KeyDown event, it offers KeyCode which directly compares to Keys.Enter without
needing the ASC function; then set SuppressKeyPress when you want to ignore the key.
BTW: you managed to use PRE tags the wrong way!
Luc Pattyn [Forum Guidelines] [My Articles]
- before you ask a question here, search CodeProject, then Google
- the quality and detail of your question reflects on the effectiveness of the help you are likely to get
- use the code block button (PRE tags) to preserve formatting when showing multi-line code snippets
|
|
|
|
|
You need a global keyhook to do that, otherwise that code will only be triggered when your form as focus.
|
|
|
|
|
You can also set the form's KeyPreview property to True, then handle the form's KeyDown or KeyPress events to do the same thing.
|
|
|
|
|
I set KeyPreview = true in the form's properties dialog & then trap keydown
Private Sub frmInvoice_KeyDown(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyEventArgs) Handles Me.KeyDown
If e.KeyData = Keys.Enter Then
'bla, bla, bla
e.Handled = True
End If
End Sub
|
|
|
|
|
Set the KeyPreview property of the form to True , that would solve your problem
-Regards
Bharat Jain
bharat.jain.nagpur@gmail.com
|
|
|
|
|
hey guy thanks for all your help
J.Hardy
|
|
|
|
|
i got my control command to my external hardware. But the question now is i was unable to see the reply but i am sure there is a reply. Wat code should i insert to be able to see the reply?
|
|
|
|
|
why don't you try reading the data from the port?
What kind of question is this?
|
|
|
|
|
Please be clear as to what are you using, for now i am assuming that you you are using serial port component that comes with .net to revive any thing you must add an event handler for DataRecived event of serialPort component
You can the use serialPort1.ReadExisting() or serialPort.Read(), method to read from the serial port
Here is an link to a similar thread , related to receiving data from a serial port.
http://www.codeproject.com/script/Forums/View.aspx?fid=1649&msg=2897853[^]
Let me know if you need any more info
-Regards
Bharat Jain
bharat.jain.nagpur@gmail.com
|
|
|
|
|
Sorry for the unclear question. Ya wat i was trying to do was to retrieve data from my serial comm port. I am able to send to the comm port but not able to receive. I already seen the link u posted. I seen to be wat i am looking for but only ting is in C#. So i was wondering if u have the .net version?
|
|
|
|
|
this is the same code converted in vb
Private Sub SerialPort1_DataReceived(ByVal sender As
System.Object, ByVal e As System.IO.Ports.SerialDataReceivedEventArgs)
Handles SerialPort1.DataReceived
If SerialPort1.BytesToRead > 0 Then
Dim byteToRead As Integer
byteToRead = SerialPort1.BytesToRead
Dim byteArray(byteToRead) As Byte
Dim lineData As String
SerialPort1.Read(byteArray, 0, byteToRead)
lineData = ConvertToString(byteArray)
End If
End Sub
Private Function ConvertToString(ByVal byteArray As Byte()) As String
Dim tempStringToReturn As String = ""
For Each bt As Byte In byteArray
tempStringToReturn = tempStringToReturn + Convert.ToChar(bt)
Next
Return tempStringToReturn
End Function
hope this helps ...........
-Regards
Bharat Jain
bharat.jain.nagpur@gmail.com
|
|
|
|
|
Please make note that i have not compiled the code , just did a manual conversion ..........
But i think it should work without any problems .
If you find any part which is not understandable please feel free to ask.
-Regards
Bharat Jain
bharat.jain.nagpur@gmail.com
|
|
|
|
|
So i should create an event as well right? By the way does the code u posted shows where the data will be display if the event is trigger? Cos i not sure if it is me that missed out anything, i cant find the displaying part.. thanks.
|
|
|
|
|
The current code does not contain the code to display any data
The data is collected in the variable linedata , you can use message box (Messagebox.show(linedata)) to display this variable or else you can use any other method to display data (data is in the variable linedata).
Also i have used the event 'DataRecived' of serialport component.
Are you facing any problem with the event, just let me know the issue , may be i can suggest a solution for the same.
-Regards
Bharat Jain
bharat.jain.nagpur@gmail.com
|
|
|
|
|
hi.. Thanks for the info. Current already tried the code and the error "cross-thread" occurred. Beside ur code i oso added a line which is txtCommand.text = lineData, from copy the string of data received to be display on the textbox and tis line causes the error. Any way to solved tis error??
|
|
|
|
|
just try this line in form load
system.Windows.Forms.Control.CheckForIllegalCrossThreadCalls = False
this is not the best of the choice , but a quick solution , the error you are getting is because some of your control is been used in two different threads , i don't have any idea as to where any why you are using threads and hence , this is the only solution i can think of know
-Regards
Bharat Jain
bharat.jain.nagpur@gmail.com
|
|
|
|
|
Yup.. This is the solution that i am using now. But i encounter something which i find very weird. After i use the checkforillegalCrossthreadcalls = false, i put breakpoints at certain part of my code and it seens to work as i can see the reply from my hardware. But when i remove all my breakpoints the cross thread error did not occur but there isnt any reply from my hardware as well. Have been trying to find the reason behind it but till now there is still isnt any explanation.
|
|
|
|