|
I'll try to do it in VB.Net this time. Be warned I don't use VB very much so there may be the odd error, but I hope to be close enough for you to understand.
Private Sub Panel1_KeyDown(ByVal sender As System.Object, ByVal e As System.Windows.Forms.KeyEventArgs) Handles TextBox1.KeyDown
Dim str As String = String.Format("{0} ({1:X4})", e.KeyCode, CType(e.KeyCode, Int32))
Me.TextBox1.Text = str
End Sub
Hope this helps. I've tested it in VB.Net Express 2005, and it works.
Henry Minute
Do not read medical books! You could die of a misprint. - Mark Twain
Girl: (staring) "Why do you need an icy cucumber?"
“I want to report a fraud. The government is lying to us all.”
|
|
|
|
|
Henry,
Thanks for the idea. However, I do not get the desired out come. Using the exact line you gave, it outputs 'OEM5' 'DC' it converted the 220 which is the \ to hex instead of the ascii value.
thanks for your effort
nathan
'Never argue with an idiot; they'll drag you down to their level and beat you with experience.' ~ anonymous
'Life's real failure is when you do not realize how close you were to success when you gave up.' ~ anonymous
|
|
|
|
|
I am sometimes extremely thick!
In case you have not solved this yet, search MSDN for the Asc Method .
Henry Minute
Do not read medical books! You could die of a misprint. - Mark Twain
Girl: (staring) "Why do you need an icy cucumber?"
“I want to report a fraud. The government is lying to us all.”
|
|
|
|
|
Private Sub Panel1_KeyDown(ByVal sender As System.Object, ByVal e As System.Windows.Forms.KeyEventArgs) Handles TextBox1.KeyDown
Dim str As String = String.Format("{0} ({1:X4})", e.KeyCode, CType(e.KeyCode, Int32))
Me.TextBox1.Text = str
End Sub
You should get the keycode (220) in the e.KeyCode argument, that is an integer. So you don't need the String.Format stuff
|
|
|
|
|
Hi,
If you can handle the KeyPress event instead of KeyDown you would get access to the KeyPressEvent.KeyChar property. Would that solve your problem?
Alan.
|
|
|
|
|
Alan,
The application we are building requires filtering of allowed keys to be pressed per textbox. so we have numeric only, keys available for ssn, fein, our id, etc. by doing so, we killed the ability to hit ctrl-v, ctrl-c, ctrl-x, shift insert(paste). so our filter is being done in keypress but to allow the copy and paste keys, i need to move the filtering to keydown where i found this issue of not getting the "accurate" ascii value for characters we could be testing for. ex i'm getting 220 when i should be getting 92. now i realize i could be testing for each character via the keys enumerator but my intent was to use Char.IsLetter(), etc.
thanks for you help...
Nathan
'Never argue with an idiot; they'll drag you down to their level and beat you with experience.' ~ anonymous
'Life's real failure is when you do not realize how close you were to success when you gave up.' ~ anonymous
|
|
|
|
|
I found it.
When i googled, i looked for KeyEventArgs for a way to do it. Turns our in the keypress event even though 'e' doesn't expose anything regarding the shift/contrl/alt etc, you can test for them anyway.
Private Sub TextBox1_KeyPress(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyPressEventArgs) Handles TextBox1.KeyPress
If (Control.ModifierKeys And Keys.Control) = Keys.Control Then
MsgBox("Pressed " + Keys.Control.ToString())
ElseIf (Control.ModifierKeys And Keys.Shift) = Keys.Shift Then
MsgBox("Pressed " + Keys.Shift.ToString())
End If
End Sub
Thanks everyone
Nathan
'Never argue with an idiot; they'll drag you down to their level and beat you with experience.' ~ anonymous
'Life's real failure is when you do not realize how close you were to success when you gave up.' ~ anonymous
|
|
|
|
|
In VB6 I was able to check the query unload event and test why the form was closing. I wanted to do this to prevent the checkbox in the upper right of the screen from being used to close the form.
in the form_closing event, I would check to see if the UnloadMode = vbFormControlMenu
It appears this will not work in .net, is there an alternative way I should look at (I want to leave the box on the form, sorry)
M
|
|
|
|
|
The way I do it, is to keep a boolean variable that is initially set to False. When the user closes the screen using the button I want them to use, I set it to true in the Button_Click event before calling the close or exit statement. Then in the Form_Closing event I cancel the close if the boolean is not True.
There might be another way...perhaps looking at the sender parm?
|
|
|
|
|
Ahhhh... very clever, I like it.
Thanks
|
|
|
|
|
If you hook into the FormClosing event, there's a FormClosingEventArgs parameter which has a CloseReason property. The CloseReason property is a value from the CloseReason enumeration; if the user closes the application this property will be CloseReason.UserClosing
Alternatively, you could override WndProc; check which message gets sent when you click the close button
Between the idea
And the reality
Between the motion
And the act
Falls the Shadow
|
|
|
|
|
dim str1 as string
dim str2 as string
dim str3 as string
I have a string "Name1 Name2 Name3" and want to do this
str1=Name1
str2=Name2
str3=Name3
how make this?
|
|
|
|
|
This assumes that you will always have exactly three names in the string:
Dim strWithNames as String = "Name1 Name2 Name3"
Dim sa() as String 'Creates a string array
sa = strWithNames.Split(" ") 'Splits string on space
Dim str1 as String = sa(0)
Dim str2 as String = sa(2)
Dim str3 as String = sa(3)
|
|
|
|
|
|
Are you talking about splitting your string, based on spaces?
Dim nameString As String = "Name1 Name2 Name3"
Dim names() As String = nameString.Split(" ")
|
|
|
|
|
Dear Reader/Developer,
I want to develop a stand alone digital dashboard application to present live data from input coming into the computer ports (e.g. USB, serial or parallel port). The data is of an engineering type (e.g. volumes, mass, loads, velocity, etc).
1) What technologies do you recommend I use? (I am keen to learn what ever is required - I currently have an understanding of VB.NET and C#.NET).
2) Do you have any source code?
3) Which port would you recommend I use and why?
4) Which platform (i.e. a Windows form or internet browser application) would you recommend and why?
The final application will be running in a hostile and stand-alone environment, so I need to ensure the solution is simple and robust.
Notes:
1) I have spent a considerable amount of time searching and trolling Google pages with little definitive success. However I did find that there were several different approaches to developing digital dashboards so I am left wondering which one is the most robust approach for my problem?
2)I do not have a large budget to purchase one of the many digital dash boards development suites that are out there at huge cost.
3) This is definitely not a homework task - it is simply a genuine enquiry to gauge how best to approach this problem.
Thank you for reading and considering this question,
Regards,
Christopher (Sciencez)
modified on Thursday, June 4, 2009 2:49 PM
|
|
|
|
|
Sciencez wrote: 1) What technologies do you recommend?
Can be done in a lot of technoligies. Which one are you familiar with?
Sciencez wrote: 2) Can you provide the source code?
No. Its not my job.
Sciencez wrote: 3) Do you have some source code in C# or VB to access a port?
No. But Google surely has. Search it.
Sciencez wrote: 3) Which platform (i.e. a Windows form or I'net browser application) would you recommend and why?
I don't exactly seem to understand your requirements. But a mention of "live data" suggests to create a service to me.
जय हिंद
|
|
|
|
|
Thank you for taking the time to read my question. I am not sure that you provided any real new information. I was looking for two types of answers;
1) An answer from a person with computer interfacing experience who understands the riggers of data collection in a hostile environment (e.g. one with limited resources and difficult environmental conditions) where there is no access to the internet and the need to have a simple and stable application. Such a person would be able to suggest a broad approach to the solution (i.e. technologies to use etc.) and say why such an approach is a good idea (based on experience) - after all there is little to be gained from re-inventing the wheel!!.
2) An answer that provided specific solutions (with source code). You might be interested to know that I have already received one such answer that addressed a particular part of the issue/problem aforementioned.
In response to your answer to part 2 of my question (i.e. "No. Its not my job.") - I thought (and still believe) that this forum was for people with detailed knowledge and/or expertise in a particular area to assist others (who have different knowledge or expertise) to address issues that they are struggling with (or wish to learn more about) - your response suggests that you see it otherwise. If we all assist each other (especially in these difficult economic times) we all survive and progress.
Thank you again for taking the time to read my question.
Sincerely
Sciencez
|
|
|
|
|
Sciencez wrote: 1) An answer from a person with computer interfacing experience who understands the riggers of data collection in a hostile environment (e.g. one with limited resources and difficult environmental conditions) where there is no access to the internet and the need to have a simple and stable application. Such a person would be able to suggest a broad approach to the solution (i.e. technologies to use etc.) and say why such an approach is a good idea (based on experience) - after all there is little to be gained from re-inventing the wheel!!.
Sounds like a homework question to me. You might start to get some overly hostile responses with dumb posts like this.
Sciencez wrote: 2) An answer that provided specific solutions (with source code).
Sorry. I got my degree years ago and NO, I won't do your homework/work for you. Feel free to search CodeProject for tutorials and post back any specific questions with your current code.
Sciencez wrote: You might be interested to know that I have already received one such answer that addressed a particular part of the issue/problem aforementioned.
Good for you. God forbid you attempt to do it with your own free will.
Cheers...........hopefully we've helped you out a little.
"There's no such thing as a stupid question, only stupid people." - Mr. Garrison
|
|
|
|
|
Dear Jon_Boy,
"Sounds like a homework question to me. You might start to get some overly hostile responses with dumb posts like this."
This is definitely NOT a "homework question" - I must apologise profusely if it sounds like one and also if this post is construed as a "dump post".
"Sorry. I got my degree years ago and NO, I won't do your homework/work for you. Feel free to search CodeProject for tutorials and post back any specific questions with your current code."
I tried to be explicit and detail exactly what I was trying to achieve. You might be interested to know that;
1) I spent several hours searching/trolling Google.
2) I also spent quite some time searching CodePoject.
3) I was hoping to find some guidance as to an overall approach to take for this problem, so that I could go away and learn the required technologies. I currently have an understanding of VB an C#, but it is many years since I was employed as a professional programmer (like you I have a degree in computing) so I am a little behind the "8-ball" when it comes to the latest technologies etc, hence why I sort the advise of the experts, - I was not seeking the entire solution just guidance on how to best approach this problem.
Thank you again for your input.
Regards,
Sciencez
|
|
|
|
|
Sciencez wrote: 2) An answer that provided specific solutions (with source code). You might be interested to know that I have already received one such answer that addressed a particular part of the issue/problem aforementioned.
I cannot see any source code in that post. Can you?
Sciencez wrote: I thought (and still believe) that this forum was for people with detailed knowledge and/or expertise in a particular area to assist others (who have different knowledge or expertise) to address issues that they are struggling with (or wish to learn more about) - your response suggests that you see it otherwise.
Offcourse it is. But it is not a plcae where you can expect someone else to write code for you. You have asked for the source code and no one will do that for you atleast here. If you can show what you have tried and where do you struggle then there will be many to help you out.
जय हिंद
|
|
|
|
|
If you know how the data is transferred over the ports, then you could use inportb and outportb to read and write data to raw ports. I'm not certain how Windows exposes these through the API though - presumably something in kernel32.dll
Between the idea
And the reality
Between the motion
And the act
Falls the Shadow
|
|
|
|
|
hi all ,
well , i have invoice form separated into 2 parts the upper part is master (header) and detail (body) in invoices where header contains date,name,invoice number,etc ..and the lower part is the body contains the datagridview with its details like the item name or code,qty,price,discount,etc ..
the problem is i want to save the invoice headers in a table and the body in another different table but with a realtion between the 2 of them by the invoice id i think i put it in the invoices' form load. but i cant get it right .
so if any one have an example by code 2 solve this prob , please send .
by the way iam using vb. net 2005 and my db is sql 2005.
thanx all .
|
|
|
|
|
People who use these forums get a bit upset when people post requests for them to just do work. Why don't you post YOUR code, tell us why it isn't working and what error messages you are getting, and we'll try to help you.
|
|
|
|
|