
jalo
Avatar/Signature-
Posts
28 -
Joined
-
Last visited
jalo's Achievements
Newbie (1/14)
0
Reputation
-
SonicBoomAu, i am not familiar with masked textboxes but it sounds like what i need - however i am reading here this is not supported in .Net - so how do i deal with that? what is the name of the event i need to handle that is for validation upon the user leaving the field? thanks for advice...
-
Can anyone give me an idea of how i can force a particular predefined format for the input in a textbox?... in particular, i need to force 2 things (on 2 different texboxes): 1. date entry of the format mm/dd/yyyy 2. entry of the format xx-nnnn-nn (where x=alphabetic and n=numberic) any advice would be greatly appreciated!
-
this didn't work either :( after some playing with the syntax i finally got it to work like this: where First_Name LIKE '%'&?&'%' and Last_Name LIKE '%'&?&'%' i am using Access db and vb.net
-
how can i change this command so that i can use LIKE, instead of " = " in the query (the part in red) ? Private Sub doCommand() command = New OleDb.OleDbCommand("Select Patient_ID, SS_Patient_ID, First_Name, Middle_Name, Last_Name, Date_of_Birth from Demographics [color=Red]where First_Name = ? and Last_Name = ?[/color]", Me.OleDbConnection2) command.Parameters.Add(New OleDb.OleDbParameter("Fname", OleDb.OleDbType.VarChar, 20)) command.Parameters.Add(New OleDb.OleDbParameter("Lname", OleDb.OleDbType.VarChar, 20)) command.Prepare() command.Parameters.Item("Fname").Value() = Me.TextBox1.Text command.Parameters.Item("Lname").Value() = Me.TextBox2.Text End Sub
-
problem with keyboard keys and their corresponding codes
jalo replied to jalo's topic in Windows Forms
i was trying to check whether a keypress is a period (in order to allow that keypress). thanks for the tip - works for me! :-) Just wodering about the syntax though - could you explain the ("."c) - i am puzzled by the c.... If Convert.ToInt32(e.KeyChar) = Convert.[color=Red]ToInt32("."c)[/color] Then 'Do something End If -
i am trying to enable specific key presses. i am having trouble with the period key and the decimal key. i tried this Asc(e.KeyChar) = Keys.Decimal Asc(e.KeyChar) = Keys.OemPeriod but it doesn't seem to work... the first line does not respond to any key press, while the second line responds to pressing "n" lowercase... i am puzzled... anyone have an idea?
-
hmmm... never knew about this... thanks anyway!
-
i thought one is supposed to be able to tab through the pages of a tab control, but apparently not.... tabbing only goes only through the elements on the first tabpage and then instead of going to the second tab page it jumps to the next control on the form. i do have the numbering of all the tabstops in order, i also tried to put this in the constructor of the form: Me.TabPage1.TabStop() = True Me.TabPage2.TabStop() = True Me.TabPage3.TabStop() = True etc. but still i am not able to tab through the pages of the tabcontrol, still only the first page is "tabbable". can someone help?
-
i am trying to clear all the textboxes contained on all tabpages of a tabcontrol, which is enclosed inside a groupbox. what i have is probably very ugly (plus it doesn't work), so please help..... (the line in red wouldn't compile) Dim ctrl As Control Dim ctrl1 As Control Dim tBox As TextBox Dim tBox1 As TextBox Dim tbPage As TabPage For Each ctrl In GroupBox2.Controls If TypeOf ctrl Is TextBox Then tBox = DirectCast(ctrl, TextBox) tBox.Clear() ElseIf ctrl Is TabControl1 Then Dim i As Integer For i = 0 To (Me.TabControl1.TabPages.Count - 1) [color=Red] For Each ctrl1 In Me.TabControl1.TabPages.Item(i)[/color] If TypeOf ctrl1 Is TextBox Then tBox1 = DirectCast(ctrl1, TextBox) tBox.Clear() End If Next Next End If Next
-
oh... i figured it... i guess i cannot use '?' (i.e. a parameter) in the SET section of the query. so i re-wrote like below and it works now! :p [color=Red]Dim temp As Integer = Integer.Parse(Me.TextBox1.Text)[/color] updateCommand3 = New OleDb.OleDbCommand("UPDATE [Event_Nuclear] SET [color=Red][Event_Nuclear].[Number_Of_Levels] = '" & temp & "'[/color] WHERE [Event_Nuclear].[sS_Event_Nuclear_ID] = ?", Me.connection) updateCommand3.Parameters.Add(New OleDb.OleDbParameter(Me.EventNuclID, OleDb.OleDbType.Integer)) updateCommand3.Prepare()
-
if i replaced the first '?' with an integer - it works... but i still can't figure out what is wrong with the '?' version.. if i print the value of the parameter after retrieving it from the textbox - it is the right value....
-
after reading some posts here, i even added the [] around the fields... but still the update does not update... pls help... updateCommand3 = New OleDb.OleDbCommand("UPDATE [Event_Nuclear] SET [Event_Nuclear].[Number_Of_Levels] = ? WHERE [Event_Nuclear].[sS_Event_Nuclear_ID] = ?", Me.connection) updateCommand3.Parameters.Add(New OleDb.OleDbParameter(Me.EventNuclID, OleDb.OleDbType.Integer)) updateCommand3.Parameters.Add(New OleDb.OleDbParameter("Number_Of_Levels", OleDb.OleDbType.Integer)) updateCommand3.Prepare() updateCommand3.Parameters.Item("Number_Of_Levels").Value() = Integer.Parse(Me.TextBox1.Text) updateCommand3.Parameters.Item(Me.EventNuclID).Value() = Me.eventID updateCommand3.ExecuteNonQuery()
-
iterating through checkboxes in a groupbox - invalid cast?
jalo replied to jalo's topic in Windows Forms
DiverDan - Your solution works wonderfully :-)) thanks! (I wrote my second post before you had posted your soluion...) -
iterating through checkboxes in a groupbox - invalid cast?
jalo replied to jalo's topic in Windows Forms
oh.... nevermind - i was referring to the wrong groupbox.... however, when i fixed that, now i get this error: System.InvalidCastException: Cast from string "chkSelected" to type 'Integer' is not valid. ---> System.FormatException: Input string was not in a correct format. at Microsoft.VisualBasic.CompilerServices.DoubleType.Parse(String Value, NumberFormatInfo NumberFormat) at Microsoft.VisualBasic.CompilerServices.DoubleType.Parse(String Value) at Microsoft.VisualBasic.CompilerServices.IntegerType.FromString(String Value) --- End of inner exception stack trace --- at Microsoft.VisualBasic.CompilerServices.IntegerType.FromString(String Value) at Main_App.TypeOfStudy.InsertMedications() in C:\Visual Basic stuff\Main App\Form2.vb:line 713 i don't have any integers in that groupbox, nor any of the text values for the checkboxes are integers. any ideas? line 713 refers to: chkSelected = CType(Controls.Item("chkSelected"), CheckBox) -
i am trying to iterate through the checkboxes in a groupbox to see which ones are selected so that i can insert the info into the datavase. I am getting a cast exception at the "For each ..." line - i wonder if a checkbox is something other than a control??? Dim chkSelected As CheckBox [color=Red]For Each chkSelected In GroupBox1.Controls[/color] chkSelected = CType(Controls.Item("chkSelected"), CheckBox) If chkSelected.Checked = True Then 'set the Meds field of the command updateCommand3.Parameters.Item("Meds").Value() = chkSelected.Text 'update the database updateCommand3.ExecuteNonQuery() End If Next The exception: System.InvalidCastException: Specified cast is not valid.