|
Thanks for your assistance, sorry, I am still a bit new to naming conventions, I have been sticking to the default names so I am not sure what to insert into your code. This includes the Form Load line of code also please. I have set the TAB index up to what I believe is by your instructions. Here is a piece of what I am working with. Where do I insert your code and how do I name the events.
Private Sub TextBox5_Validating(ByVal sender As System.Object, ByVal e As System.ComponentModel.CancelEventArgs) Handles TextBox5.Validating
Dim Box2 As Double = 0
Dim Box5 As Double = 0
If TextBox5.Text.Length = 0 Then
'http://msdn2.microsoft.com/en-us/library/139z2azd.aspx, MsgBox
MsgBox("A 'B1' value is required.", MsgBoxStyle.Exclamation)
e.Cancel = True
ElseIf Not IsNumeric(TextBox5.Text) Then
MsgBox("This 'B1' value is not numeric.", MsgBoxStyle.Exclamation)
e.Cancel = True
'http://msdn2.microsoft.com/en-us/library/system.windows.forms.checkbox.checked(VS.80).aspx, CheckBox
ElseIf CheckBox2.Checked Then
e.Cancel = False
Else
Box2 = CDbl(TextBox2.Text)
Box5 = CDbl(TextBox5.Text)
TextBox3.Text = CStr(Box5 + 1)
TextBox4.Text = CStr(Box2 - Box5)
End If
If Box5 <= 0 Then
MsgBox("Your 'B1' value must be greater than zero.", MsgBoxStyle.Exclamation)
ElseIf e.Cancel = True Then
End If
TextBox35.Clear()
TextBox36.Clear()
TextBox37.Clear()
TextBox38.Clear()
TextBox39.Clear()
End Sub
Private Sub CheckBox2_Validating(ByVal sender As System.Object, ByVal e As System.ComponentModel.CancelEventArgs) Handles CheckBox2.Validating
TextBox35.Text = TextBox5.Text
TextBox36.Focus()
End Sub
If needed right now, I would like to hit the enter key and go from textbox5 to checkbox2.
Duane in Japan
|
|
|
|
|
If you double click on the form itself that is the form load event. You would put the handler piece in that method.
The other part would be it's own function and would happen when you hit enter in the textboxes that you assign a handler to. The validating would still occur and if it didnt validate correctly you would just call e.Cancel = True in the validating event.
CleaKO
"Now, a man would have opened both gates, driven through and not bothered to close either gate." - Marc Clifton (The Lounge)
|
|
|
|
|
This is just one of ten exact calculation events, with the code that you gave, with limited infor from me, it worked but some code later in the calculator was not working properly.
The Enter key did something to the CheckBox and its name (CheckBox + Label) but it did not physically check the box, since my entire project is about Validating and the Checkbox was not actually Checked then code later did not run as intended.
Played with your code unnecessarily and played with some of my own guessing until I just had to add in CheckBox2.Checked = True. within your code so more of my code could run later.
Thanks again to all for this help, sorry for taking so long to get back, this forum moves fast.
I put the correct line of code in the Form.Load event up top too.
Private Sub TextBox5_Validating(ByVal sender As System.Object, ByVal e As System.ComponentModel.CancelEventArgs) Handles TextBox5.Validating
Dim Box2 As Double = 0
Dim Box5 As Double = 0
TextBox5.SelectAll()
If TextBox5.Text.Length = 0 Then
'http://msdn2.microsoft.com/en-us/library/139z2azd.aspx, MsgBox
MsgBox("A 'B1' value is required.", MsgBoxStyle.Exclamation)
e.Cancel = True
ElseIf Not IsNumeric(TextBox5.Text) Then
MsgBox("This 'B1' value is not numeric.", MsgBoxStyle.Exclamation)
e.Cancel = True
'http://msdn2.microsoft.com/en-us/library/system.windows.forms.checkbox.checked(VS.80).aspx, CheckBox
ElseIf CheckBox2.Checked Then
e.Cancel = False
Else
'http://msdn2.microsoft.com/en-us/library/ewf8xx62(VS.80).aspx, Convertion
Box2 = CDbl(TextBox2.Text)
Box5 = CDbl(TextBox5.Text)
TextBox3.Text = CStr(Box5 + 1)
TextBox4.Text = CStr(Box2 - Box5)
End If
If Box5 <= 0 Then
MsgBox("Your 'B1' value must be greater than zero.", MsgBoxStyle.Exclamation)
ElseIf e.Cancel = True Then
End If
TextBox35.Clear()
TextBox36.Clear()
TextBox37.Clear()
TextBox38.Clear()
TextBox39.Clear()
End Sub
Private Sub TextBox5_Validating(ByVal sender As Object, ByVal e As KeyPressEventArgs)
If e.KeyChar = Chr(13) Then
SelectNextControl(Me.ActiveControl, True, False, True, True)
CheckBox2.Checked = True
e.Handled = True
End If
End Sub
Private Sub CheckBox2_Validating(ByVal sender As System.Object, ByVal e As System.ComponentModel.CancelEventArgs) Handles CheckBox2.Validating
TextBox35.Text = TextBox5.Text
TextBox36.Text = 0
TextBox37.Focus()
End Sub
|
|
|
|
|
I manually re-ordered the DataGridView columns many times until I thought, Ahhh I can do this in code, so I did the following (note this grid contains many columns but I removed them for simplicity).
uxInformationGrid.Columns.Clear()
Me.uxInformationGrid.Columns.AddRange(New System.Windows.Forms.DataGridViewColumn() {Me.IDColumn, Me.NameColumn}) The problem with this is that it doesnt do anything. Is there a piece missing from here?
CleaKO
"Now, a man would have opened both gates, driven through and not bothered to close either gate." - Marc Clifton (The Lounge)
|
|
|
|
|
hello,Please try by changing DataGridViewColumn() to DataGridViewTextBoxColumn
shally
|
|
|
|
|
I need to get a dataview containing the sums, counts and averages of columns in a datatable that have the
same value in another column. For instamce the SUM returned dataview from this table:
A B
1 5
2 10
1 5
2 10
should return
A B
1 10
2 20
What is the computationally fastest way to do this?
tia!
|
|
|
|
|
Make a nested query. Example:
select Cnt, sum(Value)
from (
select count(*) as Cnt, Value
from SomeTable
group by Value
) as x
group by Cnt
---
single minded; short sighted; long gone;
|
|
|
|
|
OK, I see that an SQL query is good.
But I have a local datatable -- it doesn't have or need an SQL connection or dataadapter.
Should I make one to do this selection? (seems like a lot of overhead?)
Or is there a better alternative - perhaps a loop is faster?
Thanks
|
|
|
|
|
cstrader232 wrote: But I have a local datatable -- it doesn't have or need an SQL connection or dataadapter.
Should I make one to do this selection? (seems like a lot of overhead?)
Using a DataTable when the data doesn't come from a database seem like a lot of overhead in the first place...
cstrader232 wrote: Or is there a better alternative - perhaps a loop is faster?
Yes. There are dictionaries and sorted lists that you can use to easily group and sort the data.
---
single minded; short sighted; long gone;
|
|
|
|
|
Well I thought that sorted lists were not very efficient. I don't know what a dictionary refers to
in this context. Can you direct me?
ty
|
|
|
|
|
cstrader232 wrote: I don't know what a dictionary refers to in this context. Can you direct me?
MSDN Library: Dictionary[^]
---
single minded; short sighted; long gone;
|
|
|
|
|
greetings to all... i really appreciate your help it gives me new ideas and gives me more closer to what i wanted to do...
now again i need your help on how to enable to allow sorting on a gridview in which the column header not came from the controls design, but instead from run time...
start a new beginning in every ending; thats what life for......
|
|
|
|
|
try this one
datagridview1.sort(columnindex)
hope this helps
Rupesh Kumar Swami
Software Engineer,
Integrated Solution,
Bikaner (India)
|
|
|
|
|
this helps although its a little bit closer of what i wanted but i appreciate this code sir... its a great help..
but i need this one:
whenever you click the header of the gridview it will sort to descending and ascending manner....
this is easy if i use a bind gridview, but if i use run time or unbound data to the gridview then its the time i have difficulties in sorting columns by its column header...
Thank you sir...
start a new beginning in every ending; thats what life for......
|
|
|
|
|
use following code
Private Sub dgv1_ColumnHeaderMouseClick(ByVal sender As Object, ByVal e As System.Windows.Forms.DataGridViewCellMouseEventArgs) Handles dgv1.ColumnHeaderMouseClick
dgv1.Sort(dgv1.Columns(e.ColumnIndex), ComponentModel.ListSortDirection.Ascending)
End Sub
where dgv1 is datagridview object
hope this helps
Rupesh Kumar Swami
Software Engineer,
Integrated Solution,
Bikaner (India)
|
|
|
|
|
Please don't cross post.
Please try to write a subject line that is relevant.
---
single minded; short sighted; long gone;
|
|
|
|
|
did i not ask for an apology at the last part of my post?
that i mistakenly post my question on this forum VB.NET
that is supposedly for ASP.NET
before you judge, pls read or understand what is written on the post...
Thank You...
start a new beginning in every ending; thats what life for......
|
|
|
|
|
If you ever cross post you have the ability to delete your post before there are replies.
CleaKO
"Now, a man would have opened both gates, driven through and not bothered to close either gate." - Marc Clifton (The Lounge)
|
|
|
|
|
Hi,
can anyone tell me how to reduce the size of png file through vb.net?
its actual size is 623 bytes and size on disk is 8kb so i want to
reduce the size on disk up to 1 kb only.
Is there any way to do it?
Thanks with anticipation.
vandana
|
|
|
|
|
What do you mean by "actual" size?
Is it an 8 bit or 24 bit png?
---
single minded; short sighted; long gone;
|
|
|
|
|
Hi,
I made a bitmap image using graphics in vb.net and its format is Imaging.PixelFormat.Format32bppArgb and then save it as .png file
when i right click on it , it shows that its size on disk is 8kb.
So i want to reduce it up to only 1 kb.
thanks for your response
vandana
|
|
|
|
|
There's a difference between the actual "file size" and the "size on disk" size. This is something you can do nothing about. The reason is because NTFS only allocates disk space in "blocks", not bytes. An allocation block on that disk is 8096 bytes long. So, on disk, even if the file was only a single bye in length, it's sitting in a block that's 8K in size. There's NOTHING you can do about this.
|
|
|
|
|
hi
how do i capture windows shutdown/Logoff event in vb.net application.
Thanks in advance
regards
ravi
|
|
|
|
|
For Shutdown
System.Diagnistic.Process.start("shutdown","/s")
For Logout
System.Diagnistic.Process.start("shutdown","/l")
I am not sure about this
|
|
|
|
|
Hi
Thank for prompt reply, this will shutdown my mechine, actualy i wanted to capture shutdown/logoff events in my vb.net application. I am running an application for capturing user status. if user shutdown the mechine then application should update current datetime before shutdown
regards
ravi
|
|
|
|