@AgentNaam is your parameter name (think of is as a variable name). When you use @AgentNaam in your SQL you get the value of the parameter. Just like you would a variable in VB.NET
The last argument is the value you want the parameter to have. Putting in "AgentNaam" will mean the parameter will always have that value. It is like writing the following in VB.NET: Dim agentNaam As String = "AgentNaam"
I need to update a table with new values, which are inserted via textfields.
I don't get the way from textfield inserting till the actual update
Where you currently have the literal string values (That's the last argument of the Add method) you should change that to the appropriate values that have come from the text boxes.
I have a function that recieves a filepath to a XML file and a XML Schema. I need to load my XML file into a Dataset if it matches the schema.
I then need to write the XML into a database. Can somebody please give me an example of how to do this. A simple XML file with a simple schema and an equally simple data base with a few tables would be great. As soon as is possible. I just need to see an example and I can go from there.
I 'm making a project, and i need to make it well, so i want to manage exceptions well
I mean to make a message for each error, and i want to write message in French not in English, so what I should do?
I need to check data types (int - string ...) because the user can add a float in a case of integer and a string where he should enter a number...
I need to check the date format because the user can use the US or the UK system dd-mm-yyyy or mm-dd-yyyy or else.
I need to manage the errors by the application like the division by zero and else.
'Write your code here
Catch ex as exception
from above code u can able to handle any type of exception.
Now call following function at keypress event of Textbox so the user must be enter proper value
// For accept only Text & white Space pass "e" ( one of the argument of keypress event) to this function
Public Sub CheckPressedKeyText(ByVal key As System.Windows.Forms.KeyPressEventArgs)
If Not (Char.IsControl(key.KeyChar) Or Char.IsLetter(key.KeyChar) Or Char.IsWhiteSpace(key.KeyChar)) Then
key.Handled = True
// For accept only numeric value with "." pass "e" ( one of the argument of keypress event) and "sender.text" to this function
Public Sub CheckPressedKeyNumericWithDot(ByVal key As System.Windows.Forms.KeyPressEventArgs, ByVal str As String)
If str.Contains(".") Then
If Not (Char.IsControl(key.KeyChar) Or Char.IsNumber(key.KeyChar) Or key.KeyChar = ".") Then
key.Handled = True
// For accept only numeric value without "." pass "e" ( one of the argument of keypress event) to this function
Public Sub CheckPressedKeyNumericWithoutDot(ByVal key As System.Windows.Forms.KeyPressEventArgs)
If Not (Char.IsControl(key.KeyChar) Or Char.IsNumber(key.KeyChar)) Then
key.Handled = True
for date, use DateTimePicker & set format property to "Custom" and then set Custom format property to ur choice.
thanks man ...
now if i used the try ... catch ex msg(ex.msg) end try
i can't specify the error
in meaning of: if a procedure does not exist in the DB ... or if we have division by zero how to specify my msg to show ...
i want to send the folowing msg :
1- if division by zero : msgbox("Tu as fait une division par zero")
2- if connection broken : msgbox(" il y a eu une coupure de connection")
u see ... i need to take in consideration some execptions
First of all, code that's wrapped in hundreds of try/catch statements is bad code. You should first check, for example, if you may be about to divide by zero. You should use int.tryparse,double.tryparse, etc, to see if a string contains the value type you expect. You should allow casting from double to int, unless you have special reasons not to.
An exception should be, well, exceptional. It shouldn't be something that you expect to happen in normal flow.
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 want to get a reference to a control on a form given the form name and the
control name as strings. For example I want to set the enabled/visible
properties of say "mnuExit" control in "frmMain" at run time ("mnuExit" and
"frmMain" are strings retrieved from a database). GetObject function
doesn't seem to work saying "Cannot create ActiveX control". Is there a way
to do this?
I have a control called mnuExit in MenuStrip1 in FrmMain. When I try to iterate through the controls collection in FrmMain I only get reference to MenuStrip1 and not to the control mnuExit. However, when I work with the form in IDE I get reference to FrmMain.mnuExit. Is there a way to get reference to FrmMain.mnuExit through direct iteration?