|
What's with the Timer? You shouldn't be using a Timer for this at all...
Enable the Forms KeyPreview property. The handle the Forms KeyDown event. You can check for the sequence that starts a keycode, and if you see it, start collecting keystrokes for the ID, along with checking for the ending code. Once you see the ending code, you've got the entire IDcode. Put that in your TextBox, or whatever you need to do with it...
|
|
|
|
|
Dave,
Thanks for your replay,
When I capture all the keys in de keydown event it gives me the same result.
example:
Private Sub Form1_KeyDown(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyEventArgs)Handles Me.KeyDown
value += e.KeyData.ToString
End Sub
output:
Menu ALTRight ALTMenu ALTClear ALTMenu ALTClear ALTEnd Home Up LMenu Clear Menu Left Up Insert LMenu Enter
No ID.
How does the texbox capture the id? like (D93207)
It looks like the code is not send throuch the keydown event.
Thanks in advance.
|
|
|
|
|
If your still using the GetAsyncKeyState stuff, you don't need it and it's probably why you're not seeing the keystrokes.
You get the key information in the KeyDown event args.
|
|
|
|
|
Dave,
I used the GetAsyncKeyState API because I couldn't get the ID from the keydown event.
The keydown event gives me the same result.
No id but all the extra codes
I think the ibutton id is not captured by the keydown event.
Is that possible?
Thanks in advance.
|
|
|
|
|
************************Solved**************************
Dave,
I found the solution to my problem.
The keydown event gives the identification code that it is the ibutton reader.
I can capture the ibutten code in the keypress event.
private m_Sb as new stringbuilder
Private Sub Form1_KeyPress(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyPressEventArgs) Handles Me.KeyPress
If e.KeyChar = Microsoft.VisualBasic.ChrW(Keys.Return) Then
login()
Else
m_Sb.append(e.KeyChar.ToString)
End If
End Sub
Thanks for the support.
modified on Thursday, October 1, 2009 9:31 AM
|
|
|
|
|
Why don't you use programmable Keyboard
Best Of Regards,
SOFTDEV
If you have knowledge, let others light their candles at it
|
|
|
|
|
SOFTDEV,
It is a full Touch Solution.
No keyboards pressent.
Thanks in advance.
|
|
|
|
|
I have to write an inheritance hierarchy for class Quadrilateral,square and rectangle. Use Quadrilateral as base class of the hierarchy.
so for i had this
Public MustInherit Class Quadrilateral
Public Function getName() As String
Return "Shape"
End Function
Public Function Area() As Double
Return 0
End Function
End Class
Public MustInherit Class Twodimensional
Inherits Quadrilateral
Private Mx As Integer
Private y As Integer
Public Sub New(ByVal xValue As Integer, ByVal yValue As Integer)
Mx = xValue
y = yValue
End Sub
Public Property xpoint() As Integer
Get
Return Mx
End Get
Set(ByVal value As Integer)
Mx = value
End Set
End Property
Public Property Ypoint() As Integer
Get
Return y
End Get
Set(ByVal value As Integer)
y = value
End Set
End Property
End Class
Public Class Square
Inherits Twodimensional
Public sd As Double
Public Sub New()
MyBase.New(0, 0)
Side = 0
End Sub
Public Sub New(ByVal xValue As Integer, ByVal yValue As Integer, ByVal side As Double)
MyBase.New(xValue, yValue)
sd = side
End Sub
Public Property Side() As Double
Get
Return sd
End Get
Set(ByVal Value As Double)
If Value <= 0 Then
sd = 0
Else
sd = Value
End If
End Set
End Property
Public Overloads Function Area() As Double
Return sd * sd
End Function
Public Overloads Function getName() As String
Return "Square"
End Function
End Class
Public Class Rectangle
Inherits Twodimensional
Public height As Double
Public wdith As Double
Public Sub New()
MyBase.New(0, 0)
height = 0
wdith = 0
End Sub
Public Sub New(ByVal xValue As Integer, ByVal yValue As Integer, ByVal height As Double, ByVal wdith As Double)
MyBase.New(xValue, yValue)
height = height
wdith = wdith
End Sub
Public Property h() As Double
Get
Return height
End Get
Set(ByVal Value As Double)
If Value <= 0 Then
height = 0
Else
height = Value
End If
End Set
End Property
Public Property W() As Double
Get
Return wdith
End Get
Set(ByVal Value As Double)
If Value <= 0 Then
wdith = 0
Else
wdith = Value
End If
End Set
End Property
Public Overloads Function Area() As Double
Return 2 * (height * wdith)
End Function
Public Overloads Function getName() As String
Return "Rec"
End Function
End Class
Module Module1
Sub main()
Dim i As Integer
Dim shapes(1) As Quadrilateral
shapes(0) = New Square(0, 0, 5)
shapes(1) = New Rectangle(1, 1, 2, 10)
For i = 0 To shapes.GetUpperBound(0)
If TypeOf shapes(i) Is Twodimensional Then
Dim shape As Twodimensional = _
CType(shapes(i), Twodimensional)
Console.WriteLine("Two:" & vbCrLf & "Name: " & vbTab & _
"{0}" & vbCrLf & "Values: " & vbTab & _
"{1}" & vbCrLf & "Area: " & vbTab & _
"{2}" & vbCrLf, shape.getName(), shape.Area())
Else
Console.WriteLine("No such shape")
End If
Next
End Sub
End Module
I am getting a runtime error like this
Unhandled Exception: System.FormatException: Index (zero based) must be greater
than or equal to zero and less than the size of the argument list.
at System.Text.StringBuilder.AppendFormat(IFormatProvider provider, String fo
rmat, Object[] args)
at System.String.Format(IFormatProvider provider, String format, Object[] arg
s)
at System.IO.TextWriter.WriteLine(String format, Object arg0, Object arg1)
Press any key to continue . . .
|
|
|
|
|
I wouldn't have exactly done it this way myself, but, hey, it's your code.
The reason you're getting this error is (you don't say on which line it happens) probably because you're telling Console.Writeline that you're going to supply three arguments, {0}, {1} and {2}, to fill in spaces in the output string, but you only supply two of them, shape.getName() and shape.Area().
|
|
|
|
|
now I am getting output as
Two:
Name: Shape
Area: 0
Two:
Name: Shape
Area: 0
Press any key to continue . .
|
|
|
|
|
What happens when you set a breakpoint and step into the code ?
Christian Graus
Driven to the arms of OSX by Vista.
Read my blog to find out how I've worked around bugs in Microsoft tools and frameworks.
|
|
|
|
|
Even better, break that monolithic Console.WriteLine into 4 seperate WriteLine statements.
|
|
|
|
|
You seem to be confusing overload with override . Since you did not have virtual methods and overriding, the compile-time type of the variable was used which returned "Shape" instead of the name from the derived class. You should check your book (this kind of codes suggests you are either working examples out of a book or taking a class) or the internet for the syntax.
P.S. - I'm all for using breakpoints as C.G. suggested to see the where the code is going, I just thought you could use a nudge in the right direction on this one.
|
|
|
|
|
ok, here is what i am looking to do;
I have a project where i am making a Html Editor using VB.NET Win Forms. I am looking to allow the user to select page header graphics, overlay other images, gradients, glare images, ect ... and when they export the web page the program to take those pieces and export them out as a single image.
I have not done much at in the way of GDI/GDI+ programming.
Does any one have any ideas has how i can do this? or a link or two to a few articles that explain this?
Thanks for any help.
|
|
|
|
|
Easy enough. Create a Bitmap object the size of the resulting image that you need, then create a Graphics object from that Bitmap and call its DrawImage method to draw those images onto the new Bitmap where you need them.
|
|
|
|
|
I need to be able to read an XML file into a database table that has been exported from another system where the schema may be different to my database table.
Is there a way to dynamically parse a schema to map fields and add them to a database table?
|
|
|
|
|
There's no autoamtic way to do it. You'd have to write the code that takes the data from each column and puts it into the correct column in the dataset/datatable.
|
|
|
|
|
Hi,
I am new to VB (using VB 2008 Express) and am trying to write a program to access my ADSL router and download the traffic statistics. The normal way to access the router is to open IE or Firefox and enter a URL. This calls the router which initiates a new "Authentication" window prompting for a username and password.
I have successfully created s simple form and can manipulate the buttons and textboxes. I can also output some text to a file. I am completely stumped though when it comes to the webbrowser box. If I implement a webbrowser1.navigate("192.168.1.1) command the router initiates an IE "authentication" window. My program stops until an entry is made into this external window. I am also not experienced enough to know if this could also be triggered from HTML or java code. Is it possible to gain control of this window from inside the webbrowser commands ?
I would greatly appreciatte some clues as to how to solve this issue. I am not asking for code as I really want to solve this myself rather than just copy and paste. That teaches nothing.
Thanks in anticipation
Regards
John
|
|
|
|
|
Hi,
We have a Windows Service, written in VB.NET. This service is set to start Automatically on machine start. Authentication/log on parameters are included while setting the Service.
However, we now notice that the service does not start on reboot, returning a Service Failed to log on error. Starting the service manually works without problem.
Server: Win 2003, .NET 2.0
Any help towards a solution would be most appreciated.
Regards,
RB
|
|
|
|
|
Write any errors that may occur during startup of the service to the eventlog. Maybe a network connection isn't ready or something similar.
Tosch
|
|
|
|
|
Have you tried setting the service to retry it's startup if it fails? You can set it to retry after so many minutes after the 1st and 2nd failed attempts.
Steve Jowett
-------------------------
Real programmers don't comment their code. If it was hard to write, it should be hard to read.
|
|
|
|
|
You may have some other services or resources on the system that are not ready when the Windows service is started, for example SQL server usually will usually not be ready when your Windows service started.
You should trap the exception to debug what is causing the failure, ie using AppDomain.CurrentDomain.UnhandledException or Application.ThreadException (can't remember which one for services, don't have the code with me now).
|
|
|
|
|
Hello to All,
When i am leaving my application for some minutes.Then again access it then my softwares textboxs color is showing black.
Do u know what is the reason behind it?
Thanks
If you can think then I Can.
|
|
|
|
|
The color of a textbox is always black. Do you mean that the background is black ? It's something weird on your machine, no code does that automatically, and if you've not written code to style textboxes, they are not going to style themselves.
Christian Graus
Driven to the arms of OSX by Vista.
Read my blog to find out how I've worked around bugs in Microsoft tools and frameworks.
|
|
|
|
|
Hi All,
Can anyone help me.
I have tried various methods and it doesnt seem to work.
I'm trying to get string before the @ in an email address
strEmail = Eddiez@gmail.nl
//Something happens here
strBefore = Eddievdz
Messagebox.show("Hello" + strBefore)
Thank you all
|
|
|
|