|
|
Put this in the forms keydown event, it will block all keys other than the numpad:
If e.KeyCode < Keys.NumPad0 OrElse e.KeyCode > Keys.NumPad9 Then<br />
e.handled = true<br />
End If
This works because all keys are numbered and the numpad keys are numbered consecutively. This statement rejects all keys that don't fit between the 0 and 9 on the numpad. Make sure the forms keypreivew property is set to true.
This will allow top numbers and numpad(I think).
If e.KeyCode < Keys.D0 OrElse e.KeyCode > Keys.D9 Then<br />
e.Handled = True<br />
elseIf e.KeyCode < Keys.NumPad0 OrElse e.KeyCode > Keys.NumPad9 Then<br />
e.Handled = True<br />
End If
Posted by The ANZAC
|
|
|
|
|
Thanks a lot...it was a very useful information
|
|
|
|
|
your welcome.
Posted by The ANZAC
|
|
|
|
|
well u might be using textboxes to enter the values..
lets take two textboxes
so its easy man..
jst have allok at this code...
in keypress event like
Private Sub Text1box_KeyPress(ByVal eventSender As System.Object, ByVal eventArgs As System.Windows.Forms.KeyPressEventArgs) Handles TextBox1.KeyPress, TextBox2.KeyPress<br />
dim keyascii as short= Asc(eventargs.keychar)<br />
select case keyascii<br />
case 48 to 57 ' numeric keys 0 to 9 <br />
case 8 ' backspace<br />
case else ' other keys<br />
keyascii = 0<br />
end select<br />
if keyascii = 0 then <br />
eventargs.handled = true<br />
end if<br />
end sub<code>
|
|
|
|
|
Hi everyone,
I was wondering, what would be the correct way of formatting a number, based on regional settings.
For example:
Dim value as double = 123456.78<br />
Label1.Text = value
The label would show:
123456.78
I need it to show:
123,456.78 if I'm in the UK
123.456,78 if I'm in Europe
I'm sure its a simple Format problem. Just cant remember.
Any ideas
Mark
|
|
|
|
|
Use the format string "N2" to format the number. It will give you the correct format for the current regional settings.
Mark06 wrote: 123,456.78 if I'm in the UK
123.456,78 if I'm in Europe
Last time I checked UK was still part of Europe.
---
single minded; short sighted; long gone;
|
|
|
|
|
But how do I should I use it?
I tried Label1.text = String.Format(value, "N2") and it didnt work.
As for Europe, appologies, I meant countries like Germany represent decimals and thousand seperators differently to UK.
|
|
|
|
|
Tip: "didnt work" is not a very good problem description.
Use it like this:
Label1.text = value.ToString("N2")
or like this:
Label1.text = String.Format("{0:N2}", value)
---
single minded; short sighted; long gone;
|
|
|
|
|
Sir/madam,
I know the deployment process.But the problem is i want my exe get deployed into startup
Please help.
Thanks and Regrds
Pankaj Garg
|
|
|
|
|
There's a start folder in the start menu, you can put a shortcut there. There's also a Run registry key in the Windows sub keys, you can put the path there.
Christian Graus - Microsoft MVP - C++
Metal Musings - Rex and my new metal blog
"I am working on a project that will convert a FORTRAN code to corresponding C++ code.I am not aware of FORTRAN syntax" ( spotted in the C++/CLI forum )
|
|
|
|
|
Hello,
I've got 2 images, both loaded into pictureboxes.
Now i want to compare them, and if the 2 images match return "True", and if they dont match return "False". I don't want to compare the size etc. but i want to compare the pixels of both images. How can i do this?
Thanks in regard, Zaegra
--Zaegra--
|
|
|
|
|
As you're using VB.NET, you can't access the pixels directly, you'd have to loop over them using GetPixel.
Christian Graus - Microsoft MVP - C++
Metal Musings - Rex and my new metal blog
"I am working on a project that will convert a FORTRAN code to corresponding C++ code.I am not aware of FORTRAN syntax" ( spotted in the C++/CLI forum )
|
|
|
|
|
on my form i had two pictureboxes (picturebox1 & picturebox2 ), both of which had the same image loaded, two labels (label1 & label2 ) and a button (button1 ).
Dim image1 As Bitmap<br />
Dim image2 As Bitmap<br />
Dim v As Integer 'verical position<br />
Dim vt As Integer 'total height<br />
Dim h As Integer 'horizontal position<br />
Dim ht As Integer 'total width<br />
Dim thesame As Boolean = True<br />
<br />
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click<br />
<br />
image1 = PictureBox1.Image<br />
image2 = PictureBox2.Image<br />
v = 0<br />
h = 0<br />
vt = image1.Height<br />
ht = image2.Width<br />
<br />
Application.DoEvents()<br />
<br />
For v = 0 To vt - 1<br />
For h = 0 To ht - 1<br />
If image1.GetPixel(h, v) <> image2.GetPixel(h, v) Then<br />
thesame = False<br />
End If<br />
Me.Label1.Text = h<br />
Application.DoEvents()<br />
Next<br />
Me.Label2.Text = v<br />
Application.DoEvents()<br />
Next<br />
<br />
If thesame = False Then<br />
Me.Text = Me.Text & " False"<br />
Else<br />
Me.Text = Me.Text & " True"<br />
End If<br />
<br />
End Sub
Please note, this pixel by pixel comparison takes a long time, my image was relatively small, 500 x 300, larger images will take much longer. The filling of progress into the textboxes may have slowed the application down, but i used this to confirm it was all working, you can clean this up and do whatever you want with it.
The total width and height must have 1 taken away during comparison, due to the zero based indexing on images.
Also my images were identical in size and i haven't accomodated for variance in size, in this instance this comparator code would be redundant.
Posted by The ANZAC
|
|
|
|
|
Sir/madam,
I was thinking of embeding the command button in the crystal reports 2005.
micosoft did not povide the command button.Can i use the access macros to do this.
in MS access reports i can invoke buttons to the reports.
Please help.
Thanks and regards
Panakj
|
|
|
|
|
Can anyone give me a code for convert PDF to DOC?
Thanks
................
|
|
|
|
|
There is no code to do this with the framework, not in a format that could be posted here, anyhow. You'd have to buy a component to do this.
Christian Graus - Microsoft MVP - C++
Metal Musings - Rex and my new metal blog
"I am working on a project that will convert a FORTRAN code to corresponding C++ code.I am not aware of FORTRAN syntax" ( spotted in the C++/CLI forum )
|
|
|
|
|
I am invoking wordpad using system.diagnostics.process.start().
Is there a way to hide the toolbars ruler etc while opening wordpad from vb.net.I want all the main menu bar to be dispalyed with the opened file.
|
|
|
|
|
If there is, then it will be through command line arguments to wordpad. I seriously doubt it.
Christian Graus - Microsoft MVP - C++
Metal Musings - Rex and my new metal blog
"I am working on a project that will convert a FORTRAN code to corresponding C++ code.I am not aware of FORTRAN syntax" ( spotted in the C++/CLI forum )
|
|
|
|
|
Can i get some detailed info on how to give the command line arguments?Thnks asha
-- modified at 2:54 Wednesday 11th April, 2007
|
|
|
|
|
How to Add the value in a particualr column say 2 as Combobox in a VSFlexGrid 7.0. There is some problem show at the runtime suppose we take flex as object of AXVSflexGrid and put the value in flex.set_colcombolist(2,"A"),but at runtime error comes like (An unhandled exception of type 'System.NullReferenceException' occurred in system.windows.forms.dll
Additional information: Object reference not set to an instance of an object.)
if anyone have project like this or what I hv 2 do. Pls help me as soon as possible.
-- modified at 8:09 Tuesday 24th April, 2007
|
|
|
|
|
Bishwajeet Roy wrote: hv
Vowels broken on your computer ?
VB.Net is not a header that will attract the attention of people who can help. 'Add values in columns' would be an example of a sensible header.
Why are you using a VSFlexGrid in VB.NET ?
Christian Graus - Microsoft MVP - C++
Metal Musings - Rex and my new metal blog
"I am working on a project that will convert a FORTRAN code to corresponding C++ code.I am not aware of FORTRAN syntax" ( spotted in the C++/CLI forum )
|
|
|
|
|
Sir/Madam,
Can i share my contol (textbox) - which is placed in the form - with other foms
Thanks and Regads
Pankaj
|
|
|
|
|
Yes , Remember form is Public Class, so you can get the values of textbox
Develop2Program & Program2Develop
|
|
|
|
|
well you can do this thing by making a public member object
look at this in form one under a button clicking event
dim myform as new form2
myform.yourpublicmember= textbox1.text
in form two in form load event
Public YourPublicMember As String
Private Sub Form2_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
Label1.Text = YourPublicMember
End Sub
|
|
|
|