lolafuertes 145 Master Poster

The fastest way is to not allow the user to enter any unacceptable character in the text field.

You can do that with several methods:
a) Use a masked text field to enter the right value (IE: 99999,99) .
b) Prevent the user to enter invalid characters, capturing, evaluating and discarding those not acceptable.
To do so, you must enable the form to 'preview' the typed Keys by setting the KeyPreview to true in the forms properties.
Then capture the textbox KeyPress event and set the handled property of the System.Windows.Forms.KeyPressEventArgs to true, so the system will ignore this char and prevent it to be entrered in the text box. IE:

Select Case e.KeyChar
    Case "1"c, "2"c, ...., "9"c, System.Globalization.CultureInfo.CurrentUICulture.NumberFormat.CurrencyDecimalSeparator.Chars(0)  ' Instead of accepting the comma you can select to accept the decimal separator char defined on the System.Globalization.CultureInfo.CurrentUICulture.NumberFormat.CurrencyDecimalSeparator for multilanguage purposes
        IF textBox1.txt.IndexOf(System.Globalization.CultureInfo.CurrentUICulture.NumberFormat.CurrencyDecimalSeparator)<>-1 then  ' Only one comma will be accepted.
            e.Handled = True
        end if
    Case Else
        e.Handled = True
End select

Any way, once you have the right TextBox1.Text, you must revamp you SQL sentence like

"Insert INTO Test (money) VALUES (" & TextBox1.Text.Replace(System.Globalization.CultureInfo.CurrentUICulture.NumberFormat.CurrencyDecimalSeparator, "."c) & ")"

This way you can be confident that the decimal separator sent to MySQL is the ".".


Hope this helps

lolafuertes 145 Master Poster

A really easy way (today) is to use the settings of the application.
Can be easily acessed through the My.Settings class and, if you need to change any of the values to be recognized on the next run, they can be saved using the My.Settings.Save method

The settings class supports many types of data and also supports collections of strings.

Also you can define the scope (user o application) so many of the colour, fonts, etc. are set per user basis while connection strings or exchange rates can be set at application level (for all users)

Hope this helps.

lolafuertes 145 Master Poster

If you are using ACCESS, then you can change a little bit the SQL sentence as:

SELECT EXAMEN.Int_Exa, IIF(ISNULL(T.nbrTest), 0, T.nbrTest) AS nbrTest FROM EXAMEN LEFT JOIN (SELECT int_Exa, COUNT(*) as nbrTest FROM TEST GROUP BY int_Exa) AS T ON EXAMEN.Int_Exa = T.Int_Exa ORDER BY EXAMEN.Int_ExaSELECT EXAMEN.Int_Exa, ISNULL(T.nbrTest, 0) AS nbrTest FROM EXAMEN LEFT JOIN (SELECT int_Exa, COUNT(*) as nbrTest FROM TEST GROUP BY int_Exa) AS T ON EXAMEN.Int_Exa = T.Int_Exa ORDER BY EXAMEN.Int_Exa

Hope this helps

lolafuertes 145 Master Poster

Using single quotes arround the content of the textbox1.text implies htat MySql should treat it as a text.

Without the single quotes will assume that it is a number so it will try to put the value into the destination field.

In your example, "€ 22,07" is not a number or decimal value acceptable because the currency symbol. Also the decimal point separator maybe unacceptable by MySql because the comma represents the field separator.

Also be sure to 'remove' any thousands separator before sending the number to MySql.

Hope this helps

lolafuertes 145 Master Poster

Any class can have a contructor.
The constructor is a

Sub New() 
... 
End Sub

You can define wich kind of parameters you need to create the new instance of the class like

Sub New( Byval Parm1 As String, Byval Parm2 as Integer )

You can define as many parameters as you need

Inside the sub new you can do whatever you need.

Also you can define som public methods or functions to do the work

In order to return values, you can or define functions or define some properties for the class

On the Caller you must create a new instance of the class
Using the created instance you can Call the methods, call functions returning values or get the properties.

Hope this helps

lolafuertes 145 Master Poster

Nothing wrong.

Just debug the INSERT INTO IMAGE command before being ececuted, take the command string and create a new Query using the SQL language on the Access DB. See what is the message from the Access side.

Another possibility is that IMAGE is reserved word. Try INSERT INTO [IMAGE] Values ...

lolafuertes 145 Master Poster

Can you put here the IMAGE table definition?

Out of topic, if you define tabInt and tabChar as string you can initialize them on the dim statement like

Dim tabInt as String = "0123456789"
Dim tabChar as String = "ABCDEFGHIJKLMNOPQRSTUVWXYZ"

To assign the selected char you can

nouveauNom = nouveauNom + tabInt.Chars(chiffreChoisi).ToString
nouveauNom = nouveauNom + tabChar.Chars(lettreChoisi).ToString
lolafuertes 145 Master Poster

What is the content of nomImage variable?

If in the contents exists some apostrophe this can be interpreted as the end of variable value and the rest of the contents as part of the INSERT sentence wicht is not.

This is called SQL injection and is a very common problem in countries using the apostrophe in their language.

If this is the case, you can assure that the sintax is correct using

Dim sqlQRY2 As String = "INSERT INTO IMAGE(Nom_Img)  Values ('" + nomImage.Replace("'","''") + "')"

Hope this helps

lolafuertes 145 Master Poster

Just on the advanced editor search for the attach files (mange attachements) button

lolafuertes 145 Master Poster

On the sqlQRY1 you DO NOT specify wich fields to fill wich meand that the AUDIO table has only one field.

On the sqlQRY2 you specify to fill ONLY the field called Nom_Img in the table IMAGE. If this table has more fields, you must:
* Or define default values on the IMAGE table for all the rest of field and declare them as NOT required
* Or supply data for all the required fields inthe table IMAGE.

If this is not the case, please supply a table definition and the full error message.

PD: Can be a good idea to add a begintransaction and then commit the transaction (or rollback if fails), to ensure that the insert commnad(s) is/are isolated, preventing data loss.

lolafuertes 145 Master Poster

What do you have on Item(13)? On your code ony a boolean value showing or not the picture box.

What do you should have?. A good soultion is to have the full path to the picture(I.E. "D:\Pictures\PeopleILike01.jpg" or "\\Hostname\Sharename\PicturesDir\PictureNumber765.tif" ). In this case you can:

PicBox.ImageLocation = ds.Tables("Personnel").Rows(inc).Item(13)
PicBox.Refresh

lolafuertes 145 Master Poster

The print queue (spooler) is always ready to receive and enqueue new print jobs. This is a standard feature of Windows and almost all other current Operating systems.

When the printer goes on line, all the print jobs in the queue are printed.

If you want to warn the user about the status of the printer then you need to go down to the API

Try to start reading the http://www.thedbcommunity.com/index.php?option=com_content&task=view&id=218&Itemid=56.
Is based on Paradox Db, but all the principes, structures and howtos are valid to be used in Vb.net

Hope this helps

lolafuertes 145 Master Poster

Just sounds like you have a 'virus' on your machine.

Using msconfig, try to verify all the startup processes and disable every thing you don't really need.

If this does not solves the problem, try to mount the disk on another machine, as secondary disk and try to clean it with a valid antivirus. Finally, execute a chkdsk /B against the disk until no errors found, and remount th disk on your PC.

If the problem continues, maybe formatting the PC and doing a clean install solves your problems.

lolafuertes 145 Master Poster

Maybe you can create a custom query for the data you want to filter, and use it as datasource

lolafuertes 145 Master Poster

Hereafter you can find an example of the class definition.
Some hints:
* The internal class values, and those of the propertires must match in the type of variable
* You need Functions instead of Subroutines to return values.

'
'   The Rectangle class:
'
'   This class will use the system.drawing to handle the rectangle color.
'   You shoul need td add the system.drawuing .net componenet to your project references
'   If otherwise required, you can use a string to hold the color name.
'
Public Class clsRectangle
    '
    '   The class internal width
    '
    Private dblWidth As Double
    '
    '   The class internal heigth
    '
    Private dblHeight As Double
    '
    '   The class internal color
    '
    Private clrColor As System.Drawing.Color
    '
    '   Default constructor, without parameters
    '
    Public Sub New()
        '
        '   Default height assigned to the class internal heigth
        '
        Me.dblHeight = 1D
        '
        '   Default width assigned to the class internal width
        '
        Me.dblWidth = 1D
        '
        '   Default white color assigned to the class internal color
        '
        Me.clrColor = Drawing.Color.White
        '
    End Sub
    '
    '   Contructor with parameters: 
    '       dblwidth: a double indicating the desired width of the rectangle
    '       dbllength: a double indicating the desired heigth of the rectangle
    '       rectanglecolor: a system.drawing.color to paint the rectangle
    '
    Public Sub New(ByVal dblwidth As Double, _
                    ByVal dbllength As Double, _
                    ByVal rectanglecolor As System.Drawing.Color)
        '
        '   Assign the width to the internal class width
        '
        Me.dblWidth = dblwidth
        '
        ' …