Begginnerdev 256 Junior Poster

Have you tried making use of IsNumeric?

For example:

  For Each row As DataRow In dts.Tables("[Sheet1$]").Rows
        If IsNumeric(row(0)) Then
            If row(0).ToString.StartsWith("98") Then
                Dim cell1, cell3 As String
                Dim col1, col2, col3, col4 As String

                col1 = String.Empty
                col2 = String.Empty
                col3 = String.Empty
                col4 = String.Empty

                cell1 = row(0).ToString
                cell3 = row(2).ToString

                If cell1.Length = 5 Then
                    col1 = cell1.Substring(0, cell1.Length - 3)
                    col2 = cell1.Substring(2, cell1.Length - 2)
                End If

                If cell3.Length = 5 Then
                    col3 = cell3.Substring(0, cell3.Length - 4)
                    col3 = cell3.Substring(1, cell3.Length - 2)
                End If

                DataGridView1.Rows.Add(col1, col2, col3, col4)
            End If
        End If
    Next
zelrick commented: Thank you Sir, IsNumeric solve the "98" problem +1
Begginnerdev 256 Junior Poster

A SELECT CASE would look something like:

Select Case Mid(txtLine, 18, 1)
    Case "G", "T", "C", "W"
        'Do this stuff only for those
    Case Else
        'Do some stuff
End Select

Here is an article that might help you get a little better understanding.

Begginnerdev 256 Junior Poster

Q: What do you call a dog which has no legs?
A: Anything you want; he's still not coming to you.

tobyITguy commented: Lmao!! +0
Begginnerdev 256 Junior Poster

A few questions would be:

What carrier?
Do you want external storage?
Do you prefer a certain OS?

Elvi commented: I prefer android os +0
Begginnerdev 256 Junior Poster

After reading over a few documents with HP; I have not discovered any solutions that stand out.

You might want to give this a try to see if it finds something.

Begginnerdev 256 Junior Poster

First thing is that when you formatted the hard drive you effectively 'removed' everything that was on the drive. This is why you are receiving the "no bootable device" error. There is not an operating system on the drive that can bootstrap it's self.

As for why it is not showing mounted when you connect it to another computer, you may have a driver missing on the second computer that allows that external enclosure to mount.

You will have to aquire a legitimate copy of an operating system. If you are currently seeking a free alternative; I would suggest linux.

There are many different flavors (distros) of linux to chose from. If you are not completely certain which to try then I would recommend Ubuntu. From my experience it has been stable and pretty user friendly compared to some of the others. But that is a bias opinion! :)

Begginnerdev 256 Junior Poster

Try declaring an integer value at the class level:

Dim iCount as Integer = 0

Then increment on removal:

If listItem.SubItems.Item(0).Text = " " Or listItem.SubItems.Item(0).Text = "" Then
    ListView1.Items.Remove(listItem)
    iCount += 1
End If

Once finished print out the count:

If iCount > 0 Then
    MsgBox("Clearing completed." & iCount & " Lines were removed.")
End If
Begginnerdev 256 Junior Poster

I currently do not have any screen capture software, but I will try to explain it for you.

 Dim con As New OleDb.OleDbConnection("Provider=127.0.0.1;Data Source=mydb;" & _
 "User Id=myUsername;Password=myPassword;")

What this line does is create an object that will connect to the database. The parameters above are: Provider, Data Source, User ID, and Password.

These Paramters break down as follows:

Provider - The Server that is hosting the database (If a local use 127.0.0.1)
Data Source - The name of the database that you are targeting
User ID - A user that has access to that database (Set up through MySQL)
Password - The user's password (Set up through MySQL)

con.Open()

This line is opening the connection to the database.

Dim cmd As New OleDb.OleDbCommand("INSERT INTO Students(LastName,FirstName,MiddleName) OUTPUT INSERTED.StudentID VALUES(?,?,?)", con)

This line is setting the command that you are issuing to the database.

The command is telling the database engine to insert a new record into the table named Students. The command is also telling the database engine that you are supplying the LastName, FirstName, and MiddleName column values. These columns are set up in the database when you create the Students Table.

The "OUTPUT" Clause tells the command that you wish to retreive the ID of the student that you just inserted.

The Values clause tells the database engine that the column values that you have specified before are about to follow.

Please read this for more …

Begginnerdev 256 Junior Poster

The foremost issue to resolve would be to find what the IP will be for the connection string. The rest will be syntax.

For your correct connection string see this.

Now, for example:

   Protected Friend Function Insert(sFirstName As String, sLastName As String, sMiddleName As String) As Integer
        'Replace home address with IP for hosting server
        Dim con As OleDb.OleDbConnection("Provider=127.0.0.1;Data Source=mydb;" & _ 
                                         "User Id=myUsername;Password=myPassword;")
        Try
            con.Open()
            Dim cmd As New OleDb.OleDbCommand("INSERT INTO Students(LastName,FirstName,MiddleName) OUTPUT INSERTED.StudentID" & _
                                                                   " VALUES(?,?,?)", con)

            cmd.Parameters.AddWithValue("@LastName", IIf(sLastName = String.Empty, DBNull.Value, sLastName))
            cmd.Parameters.AddWithValue("@FirstName", IIf(sFirstName = String.Empty, DBNull.Value, sFirstName))
            cmd.Parameters.AddWithValue("@MiddleName", IIf(sMiddleName = String.Empty, DBNull.Value, sMiddleName))

            'Returns the inserted student's ID
            Return CInt(cmd.ExecuteScalar)
        Catch ex As Exception
            MsgBox(ex.Message, MsgBoxStyle.Critical, "Student.Insert")
            Return -1
        Finally
            con.Close()
        End Try
    End Function

Now you can insert a student like so:

If Insert("John","Doe","Lotta") > 0 Then
    'Inserted
Else
    'Did not insert
End If
Begginnerdev 256 Junior Poster

As you may already know. Most Printers support the TWAIN interface. Most printers also support WIA.

This being said, you could use a TWAIN or WIA library to access your scanner (Pending drivers are installed).

See attached file for code for a scanning library! (Courtesy of Mkasoft)

Place the code in a codefile and compile it into a library, then add that library reference to your project.

To use the code, try:

Private sMyScanner As String = String.Empty

Private Sub btnSelectSource_Click(sender As System.Object, e As System.EventArgs) Handles btnSelectSource.Click
    'Set the scan source for your scan.
    sMyScanner = TwainLib.GetScanSource
End Sub

Private Sub btnScan_Click(sender As System.Object, e As System.EventArgs) Handles btnScan.Click
    'Scan images from source and place the file path in a list of string for later access.
    Dim lstFiles As List(Of String) = TwainLib.ScanImages(".bmp", True, sMyScanner)
End Sub
Begginnerdev 256 Junior Poster

May I suggest a safer method of storing a password?

You could create a database in something as simple as access and store the passwords in a table.

To increase the security further, you can encrypt the passwords and store the encrypted string into the database.

This method is called trap door encryption.

(Example uses Microsoft's example found here)
(Example uses Access 2010 and Visual Studio 2010)
(Example connection code uses System.Data.OleDB)

For example:

Imports System.Security.Cryptography 
Public Class Encryption
    Private TripleDes As New TripleDESCryptoServiceProvider

    Sub New(ByVal key As String)
        ' Initialize the crypto provider.
        TripleDES.Key = TruncateHash(key, TripleDES.KeySize \ 8)
        TripleDES.IV = TruncateHash("", TripleDES.BlockSize \ 8)
    End Sub

    Private Function TruncateHash( ByVal key As String, ByVal length As Integer) As Byte()
        Dim sha1 As New SHA1CryptoServiceProvider

        ' Hash the key. 
        Dim keyBytes() As Byte =
            System.Text.Encoding.Unicode.GetBytes(key)
        Dim hash() As Byte = sha1.ComputeHash(keyBytes)

        ' Truncate or pad the hash. 
        ReDim Preserve hash(length - 1)
        Return hash
    End Function

    Public Function EncryptData(ByVal plaintext As String) As String

        ' Convert the plaintext string to a byte array. 
        Dim plaintextBytes() As Byte =
            System.Text.Encoding.Unicode.GetBytes(plaintext)

        ' Create the stream. 
        Dim ms As New System.IO.MemoryStream
        ' Create the encoder to write to the stream. 
        Dim encStream As New CryptoStream(ms,
            TripleDes.CreateEncryptor(),
            System.Security.Cryptography.CryptoStreamMode.Write)

        ' Use the crypto stream to write the byte array to the stream.
        encStream.Write(plaintextBytes, 0, plaintextBytes.Length)
        encStream.FlushFinalBlock()

        ' Convert the encrypted stream to a printable string. 
        Return Convert.ToBase64String(ms.ToArray)
    End Function

    Public Function DecryptData(ByVal encryptedtext As String) As String

        ' Convert …
Santanu.Das commented: High antibiotics for a simple temperature +4
Begginnerdev 256 Junior Poster

The only problem that you will have to make double sure that you have solved would be static IP addressing. If you are currently running through DHCP method of addressing, every n (n being number chosen by your ISP - usually 24) hours your IP will change on your host computer. This will be a HUGE problem with domain providers that require a static (unchanging) IP address. You will need to call your ISP to see that they do infact support this. Once you have done so, then you will need to configure IIS.

As you stated previosly, the operating system you have chosen to use is Windows Server 2008 r2. This means that your IIS version should be 7 or 7.5.

Please read this article on how to configure IIS to host your website.

Begginnerdev 256 Junior Poster

If the array is placed in the same codefile as the events, then public/shared modifiers are not needed.

May I suggest a list?

Dim array_shuffle As New List(Of Integer)

Lists are a class that implements the IEnumerable interface.
Therefore, you will have the ability to sort,search,add,remove and event use LINQ statements on the list.

   array_shuffle.Sort(MyIntComparer)
   array_shuffle.Add(101) 'Will add an item to the list with the value of 101
   array_shuffle.Remove(101) 'Will remove the entry of value 101

   Dim query = From iVal In array_shuffle
               Where iVal > 100
               Select iVal

   query.ToArray() 'Will return an integer array containg all values that are larger than 100.

As for comparison help please see this.

Begginnerdev 256 Junior Poster

You can condense your query a little by giving your select tables an alias.

For example:

"INSERT INTO patempTable SELECT pr.[Project Number],pr.[Employee Number],pr.[Current Month],pr.[Net Pay],al.[Net Allowance], pd.[Net] FROM [Pay_roll] pr, [Allowance] al, [Per_diem_accomodation]"

Now for tieing the tables together, my question would be: Are there multiple 'P' codes or are you just wanting to select where everything matches?

If you are just wanting to select where everything matches you can simply do something like this:

" WHERE (pd.[Project Number] = al.[Project Number] AND al.[Project Number] = pr.[Project Number])"

The ambiguity comes in with the selection by month/year.

You can try to wrap these statements with parenthesis for qualification.

For example (When added to strings above):

" AND (pr.[Current Month] = '6' AND al.[Current Month]='6' AND pd.[Current Month]='6')"
Begginnerdev 256 Junior Poster

Sorry for the hiatus.

Have you checked to verify if the correct number of BUTTONX Outputs exists?

For example, press button one 3 times then press button two 3 times.

Or is the output returning empty string on some of the button presses?

Begginnerdev 256 Junior Poster

You are talking about Operating System features here. To do something like this you will have to do some reasearch into the Windows API to see if this is possible(Most likely).

If it did, I might even go as far to say that this may cause your application to be flagged as a malicious application by anti virus software.

Another thing: You don't have to use VB 5.0 for the executable. You can create an executable from a VAST majority of lanuages floating around out there. (VB.NET included)

Begginnerdev 256 Junior Poster

When you say that you are saving the data in the settings, are you referring to application settings? If so, then this will be an extremely inefficient method of storage.

Why not store the history in a csv? (If the data is not confidential!)

Then you could load your listview with the data from the CSV.

When saving, create a small function to write to the file and return a value.

For example:

Private Function SaveHistoryItem(ByVal sDateString As String, ByVal dTimeOfDay As DateTime) As Boolean
    Try
        Dim fp As String = My.Settings.FilePath 'String variable in Application settings containing the full path to the CSV File

        'Check if the file exists, if not, create it.
        If Not File.Exists(fp) Then File.Create(fp)

        Dim sw As New StreamWriter(fp, True)

        'Formats the data:
        '01/20/2013,11/21/2013 14:36:04'
        sw.WriteLine(sDateString & "," & dTimeOfDay.ToString)

        sw.Close()
        sw.Dispose()
        fp = Nothing

        Return True 'SAVED
    Catch ex As Exception
        MsgBox(ex.ToString)
        Return False 'FAILED
    End Try
End Function

You can use a function like this like so:

If SaveHistoryItem("01/01/2013",Now()) Then
    'Clean Up
Else
    'Didn't save, do something!
End If

Now, to load the data, write another small function to retreive the values from the CSV file and to pass them to your form.

For example:

Private Function ReadFromHistory() As List(Of List(Of String))
    Try
        Dim fp As String = My.Settings.FilePath

        If Not File.Exists(fp) Then Return New List(Of List(Of String))

        Dim sr As New StreamReader(fp)
        Dim lstStrings As New List(Of List(Of String))

        While sr.Peek <> -1
            lstStrings.Add(sr.ReadLine.Split(",").ToList)
        End While

        'List …
Reverend Jim commented: Very thorough +12
Deep Modi commented: good suggestion but can you still do something? +3
Begginnerdev 256 Junior Poster

Sounds like an assignment, but hey - I'll give you the doubt. You can start by declaring your tables.

Sounds like you need some lookup tables and a main table.

Something like this:
a30819fe0887588372aaafb950b79cce

Begginnerdev 256 Junior Poster

If you think of your screen as a quadrant, it would have the y axis reversed.
(X,Y)
0,0 | 1,0 | 2,0 | 3,0 |
0,1 | 1,1 | 2,1 | 3,1 |
0,2 | 1,2 | 2,2 | 3,2 |

This being said, you see a positive value in debug because you are viewing the values before the interpreter sees the '-'

Begginnerdev 256 Junior Poster

As shown here; the TranslateTransform sets the new zero point of the drawing.

When you call this you are setting the new zero point to the center of the screen. (1/2 sz.Width, 1/2 sz.Height).

Therefore, when you tell it to draw the string at 5,6 it will draw using the new zero.

ddanbe commented: Nice. +14
Begginnerdev 256 Junior Poster

My routine usually goes as follows:

Average day:
Cardio(Running)
Compound Exercises(By Muscle Group)

Schedule:
Monday - Upper
Tuesday - Lower
Wednesday - Rest
Thursday - Upper
Friday: Lower
Saturday - Touch Up
Sunday - Rest

Chest/Arms:
Bench Press
-Flat
-Incline
-Decline

Curling
-Preacher curls
-Hammer
-Modified Hammer (Twist dumbell when 3/4 into contraction)

Bench Dips

Shoulders/Back:

Facepulls:
-Top down
-Face level
-Bottom up

Rows

Pulldowns
-Font (Bar touches chest)
-Back (Bar touches traps)

Legs:

Legpress:
-Warm up at 700
-3 sets of 15 reps at 1100
Squats:
-Warm up at 205
-3 sets of 15 reps at 450

Running to finish legs off

cproger commented: Wow +0
Begginnerdev 256 Junior Poster

Sorry, I typed the code into the editor.

Try wrapping the first half of the if with a Not IsNothing()

If Not IsNothing(ds.Tables("Login")) And ds.Tables("Login").Rows.Count > 0 Then
Begginnerdev 256 Junior Poster

After reading this code, I hope that this system is not being implemented in a corporate environment. This is horribly insecure - using some one's last name as a password will almost guarantee an easy data breach.

As for the code, why are you selected the contents of the entire table?

Just look for the contents by ID.

For example:

'Class wide variable
Dim iAttempts As Integer = 0


If iAttempts > 3 Then
    MsgBox("Login attempts have exceeded 3!")
    Exit Sub
End If

Dim da As New OleDBDataAdapter(New OleDBCommand("Select ID, LASTNAME, FIRSTNAME, LOGINSTATUS from Users WHERE ID='" & txtID.Text & "'",New OleDBConnection("Provider=Microsoft.Jet.OLEDB.4.0;Data Source=C:\Users\Renz\Documents\Visual Studio 2012\FINAL\Database\AuditDB.mdb")))
Dim ds As New DatSet

da.Fill(ds,"Login")

If ds.Tables("Login") And ds.Tables("Login").Rows.Count > 0 Then
    If ds.Tables("Login").Rows(0)("LASTNAME") Then
        If txtPassword.Text = "admin" Then
            'Staff
            iAttemtps = 0
        Else
            'Student
            iAttempts = 0
        End If     
    Else
        MsgBox("Password was incorrect!")
        iAttempts += 1
    End If
Else
    MsgBox("Could not find ID!")
    iAttempts += 1
End If
saintrenz commented: Error 1 Operator 'And' is not defined for types 'System.Data.DataTable' and 'Boolean'. +0
Begginnerdev 256 Junior Poster

What error does the Connection.Open() method throw?

You can do a try/catch with a msgbox to find out:

Try
    con.Open()
Catch ex As Exception
    MsgBox(ex.ToString())
End Try
Begginnerdev 256 Junior Poster

How are you connecting inside your application?

Generally if you wrap your connect code in a try/catch a problem will be thrown.

Have you check your connection string?

Begginnerdev 256 Junior Poster

I copied the code into a blank project and created what I assume to be the form and I can see part of your problem is that you allow the user to press the play button when the counter is already to zero.

You will need to disable the play button when the counter hits zero.

For example:

If intCounter > 0 Then
    intCounter -= 1

    If intEnterNum <> ranNum Then
        If intCounter > 0 Then
            MessageBox.Show("Wrong guess again. You have " & intCounter & " chances left.")
        Else
            txtbxEnterNum.Enabled = False
            If MessageBox.Show("Game Over", "Try Again", MessageBoxButtons.YesNo) = Windows.Forms.DialogResult.Yes Then btnReset.PerformClick()
        End If
   Else
       If MessageBox.Show("Correct! Do you wish to restart?", "Please Confirm Action", MessageBoxButtons.YesNo) = Windows.Forms.DialogResult.Yes Then btnReset.PerformClick()
   End If
End If

Now change your btnReset_Click sub to look something like:

Private Sub btnReset_Click(sender As System.Object, e As System.EventArgs) Handles btnReset.Click
    txtbxEnterNum.Clear()
    txtbxEnterNum.Enabled = True
    ranNum = 0
    intCounter = 3
End Sub
Begginnerdev 256 Junior Poster

If you are receiving the prompt above then you have more problems than that code. ^_^

I do not see the message box which you are talking of.

Is this code snippet the full code? (I am assuming it is because of the class tags)

Begginnerdev 256 Junior Poster

1066Mhz is the speed that ram will send/receive data.

The kit that you are looking at is an 8gb kit. (8192mb kit)

This is the amount that will be added to your memory bank.

Begginnerdev 256 Junior Poster

I am not so sure about the legitimacy of the email lookup @ pwndlist.

After typing:

a@a.a
b@b.b
c@c.c

All of the address returned N occurrences since July, 2011
All of the address had been compromised 4 months ago.

Begginnerdev 256 Junior Poster

If you are only wanting to increase the width (on the left) you will have to reposition the panel on resize to give the user the illusion it is only increasing the width on the left.

For exmaple:

Do While Panel1.Width < 730
    Panel1>Width += 1
    Panel1.Location = New Point(Panel1.Location.X - 1, Panel1>Location.Y)
Loop
Begginnerdev 256 Junior Poster

It would be easier to do a SELECT with an inner join.

Something like:

"SELECT SEGDATA.AdminNo, Paperslist.PaperNo InnerJoin SEGDATA on PapersList.Module1 = SEGDATA.ModuleCode"

But my SQL is a little lacking

I hope this points you in the right direction.

Reverend Jim commented: Nothing lacking there. +12
Begginnerdev 256 Junior Poster

Not knowing =/= Laziness.

It is a good thing that you are willing to learn!

Begginnerdev 256 Junior Poster

You could take that string returned, split and parse it to what you need.

For example:

Private Function ParseIngredients(ByVal strIngredients As String) As Dictionary(Of String, Double)
    Try
        strIngredients = "(Water (20), Salt(30))" 'When passing the value in delete this, this is just for example.
        Dim dic As New Dictionary(Of String, Double)

        Dim lstIngredients As List(Of String) = strIngredients.Split(",").ToList()
        'lstIngredients(0) = "(Water (20)"
        'lstIngredients(1) = "Salt (30))"

        For Each s As String In lstIngredients

            Dim Key As String = String.Empty
            Dim Value As Double = 0.0
            s = s.Replace("(", "") 'Will return "Water 20)"
            s = s.Replace(")", "") 'Will return "Water 20"

            Key = s.Split(" ").ToList(0) ' Will return Water
            Value = Cdbl(s.Split(" ").ToList(1)) 'Will return 20.0 as Double
            'The key will be set to Water
            'The value will be set to 20

            'Add to dictionary
            dic.Add(Key, Value)
        Next

        Return dic
    Catch ex As Exception
        MsgBox(ex.ToString)
        Return New Dictionary(Of String, Double)
    End Try
End Function

Just pass in the ingredients string and accept the output dictionary.

Iterating through the dictionary can be done as follows:

For Each kvp As KeyValuePair(Of String,Double) In ParseIngredients(IngredientsStringHere)
    DeductFromTotal(kvp.Key,kvp.Value)
Next

I hope this helps!

ddanbe commented: Helpfull +14
Begginnerdev 256 Junior Poster

Place the code in a sub procedure and pass in the item type for the action:

Private Sub DeductFromTotal(ByVal sItemType As String,ByVal dblAmountToSubtract As Double)
    Try
        Dim da As New MySqlDataAdapter(New MySqlCommand("SELECT * FROM Inventory WHERE Item='" & Me.ComboBox1.Text & "'", New MySQLConnection("ConnectionStringHere")) 
        'You don't have to open the connection before using it in the adapter.'
        'The select gets the table structure.'

        Dim ds As New DataSet
        da.Fill(ds, "Inventory")
        If Not IsNothing(ds.Tables("Inventory")) And ds.Tables("Inventory").Rows.Count > 0 Then
            Dim dblCurrentAmount As Double = CDbl(ds.Tables("Inventory").Rows(0)("Amount")) - dblAmountToSubtract '(This dblAmountToSubtract is not declared, what should it be set to?)
            If dblCurrentAmount < 0 Then
                MsgBox("You have used more than what is in stock!" & vbCrLf & "This operation will not be completed", MsgBoxStyle.Exclamation, "ERROR!")
                GoTo DISPOSE
            ElseIf dblCurrentAmount = 0 Then
                MsgBox("You have depleted your stock for this item!" & vbCrLf & "Please restock this item!", MsgBoxStyle.Exclamation, "Oops!")
            End If

            ds.Tables("Inventory").Rows(0)("Amount") = dblCurrentAmount
            da.UpdateCommand = New MySQLCommandBuilder(da).GetUpdateCommand
            da.Update(ds, "Inventory")
            MsgBox("Item Updated!", MsgBoxStyle.Information, "Complete!")
        End If
DISPOSE:
            da = Nothing
            ds = Nothing
    Catch ex As Exception
        MsgBox(ex.ToString)
    End Try      
End Sub

Then call it from code (A button click would work)

Private Sub btnSalad_Click(sender As Object, e As EventArgs) Handles btnSalad.Click
    Try
        'Get list of ingredients from table
            For Each s As String In lstIngredients 'List(Of String)
                DeductFromTotal(s,Cdbl(txtIngredient1.Text))
            Next
    Catch ex As Exception
        MsgBox(ex.ToString)
    End Try
End Sub

This begs the question: How are you binding an ingredient list to the item type?

Are you doing something like this?

Begginnerdev 256 Junior Poster

dblAmountToSubtract will be a variable declared as double that will hold the value to subtract from your total.

For Example:

Dim dblAmountToSubtract As Double = Cdbl(txtAmountUsed.Text)
'This pulls the amount from a text box on a form.

For the command, you can simply replace:

da.UpdateCommand = New OleDb.OleDbCommandBuilder(da).GetUpdateCommand

With

da.UpdateCommand = New MySQLCommandBuilder(da).GetUpdateCommand
Begginnerdev 256 Junior Poster

The select statment retreives the record from your database table.

For example:

Inventory
Item  | Amount
garlic,10.21
onion,50.13
water,200.23


"SELECT * FROM Inventory WHERE Item='garlic'" 'Would return garlic,10.21

As for the myConnection, you will need a connection to the database to retreive the data from the database.

In this case, my connection would look as follows:

Dim myConnection As New OleDBConnection("MyConnectionStringHere")

For connection strings, see this website.

I hope this clears things up for you!

savedlema commented: Thanks Begginerdev. Please check my reply. +0
Begginnerdev 256 Junior Poster

You will have to get the current value, subtract, then update to the newest value.

This is assuming your amount colum in as decimal value.

For Example:

       Try
            Dim da As New OleDbDataAdapter(New OleDbCommand("SELECT * FROM Inventory WHERE Item='" & sItemType & "'", myConnection))

            'The select gets the table structure.
            Dim ds As New DataSet

            da.Fill(ds, "Inventory")

            If Not IsNothing(ds.Tables("Inventory")) And ds.Tables("Inventory").Rows.Count > 0 Then
                Dim dblCurrentAmount As Double = CDbl(ds.Tables("Inventory").Rows(0)("Amount")) - dblAmountToSubtract

                If dblCurrentAmount < 0 Then
                    MsgBox("You have used more than what is in stock!" & vbCrLf & "This operation will not be completed", MsgBoxStyle.Exclamation, "ERROR!")
                    GoTo DISPOSE
                ElseIf dblCurrentAmount = 0 Then
                    MsgBox("You have depleted your stock for this item!" & vbCrLf & "Please restock this item!", MsgBoxStyle.Exclamation, "Oops!")
                End If

                ds.Tables("Inventory").Rows(0)("Amount") = dblCurrentAmount

                da.UpdateCommand = New OleDb.OleDbCommandBuilder(da).GetUpdateCommand
                da.Update(ds, "Inventory")

                MsgBox("Item Updated!", MsgBoxStyle.Information, "Complete!")
            End If
DISPOSE:
            da = Nothing
            ds = Nothing
        Catch ex As Exception
            MsgBox(ex.ToString)
        End Try 
Reverend Jim commented: Nice complete answer. +12
savedlema commented: Thanks Begginerdev. Please check my reply. +2
Begginnerdev 256 Junior Poster

The number on the end of each function represents the bit count, therefore, represents the maximum value that can be returned by that function ( as Integer )

Int16 - 16bit
Int32 - 32bit
Int64 - 64bit

As for the decimal places, the ToInt32 function returns an integer, which is a whole number. Therefore the decimal value will be rounded.

Begginnerdev 256 Junior Poster

You could place a timer on SplashScreen1, then do the following:

DIm ss1 As New SplashScreen1

ss1.ShowDialog() 'Will be a modal window and will not show Form2 Until it is closed.
ss1 = Nothing

Form2.Show()

Now, for the timer bit, in the SplashScreen_Load event place a timer.Start.

Private Sub Me_Load(ByVal sender As Object, ByVal e As EventArgs) Handles Me.Load
    Try
        Timer1.Start()
    Catch ex As Exception
        MsgBox(ex.ToString)
    End Try
End Sub

Now place the closing code in the timer.Tick method.

Private iCount As Integer = 0 'Must store value of timer tick.
Private Sub Timer1_Tick(ByVal sender As Object, ByVal e As EventArgs) Handles Timer1.Tick
    iCount += 1
    If iCount = 5000 THen Me.Close
End Sub

This will wait as long as you want, then close the form after the given span. (In this example it is 5 seconds)

Begginnerdev 256 Junior Poster

Why dont you just make use of the splash screen setting in the My Application > Application menu?

8ae345254c4c9bb69e810b0ff6e79a04

ddanbe commented: Good advice! +14
Begginnerdev 256 Junior Poster

I'm sorry, but we can't answer quizes/tests for you.

We are a help forum, not a DO forum.

Begginnerdev 256 Junior Poster

P.D The code doesn't need to be pretty, stable or optimized, but if it works, it's great.

Whoa now! If the code isn't stable - it never worked to begin with! =)

LuisAZC commented: LOL, you're right, my mistake. +0
Begginnerdev 256 Junior Poster

First off, it is bittersweet to be ahead of your class. Bitter due to having a higher chance to make errors on code that you can't fully understand, but sweet because you can use the time to improve your coding/understanding of the language and logic.

As for this:

   Public Function ReadLine(ByVal lineNumber As Integer, ByVal lines As List(Of String)) As String
       Return lines(lineNumber - 1)
   End Function

If the value of lineNumber is equal to zero or greater than the size of the list + 1 you will always get this error.

You can fix this with something like this:

  Public Function ReadLine(ByVal lineNumber As Integer, ByVal lines As List(Of String)) As String
       If lineNumber - 1 > lines.Count - 1 Then Return "lineNumber was to large for the list: " & (lineNumber - 1) & " > " & lines.Count
       Return lines(lineNumber - 1)
  End Function

If you are trying to retreive the last element in the list, try this:

Public Function ReadLine(ByVal lines As List(Of String)) As String
    If lines.Count <=0 Then 
        Return String.Empty
    Else
        Return lines(lines.Count - 1)
    End If
End Function 

This will return the last element of the list, being the last line read in from the text file.

Begginnerdev 256 Junior Poster

How are you declaring imageList?

Is it:

Dim imageList as New List(Of Image)

How are you storing these images?

Begginnerdev 256 Junior Poster

You can make use of the PrintForm class from the Power Packs.

For example:

Public Class Form2

    Public WriteOnly Property _PrintForm As Boolean
        Set(value As Boolean)
            If value = True Then
                Dim pf As New PrintForm
                    pf.Form = Me
                    pf.PrintAction = PrintToPrinter
                    pf.Print()
            End If
        End Set
    End Property

End Class

Then to call it from form1:

Public Class Form1
    Private btnPrint_Click(ByVal sender As Object,ByVal e As EventArgs) Handles btnPrint.Click
        Form2._PrintForm = True
    End Sub
End Class

Or, you can manually print by using the PrintDocument event of a printing job.

This will require the use of the Graphics class.

TnTinMN commented: PrintForm to the rescue :) +8
Begginnerdev 256 Junior Poster

Using the WebBrowser would be the easiest solution. The problem being with it is that the scroll bars will be in sight.

You can set the document with something like this:

WebBrowser1.DocumentText = "<html> <body> <img src=""PathToMyGIF""Height='300' Width='300'> </body> </html>"
Begginnerdev 256 Junior Poster

Just noticed that your string:

Server.MapPath("~/Content/Reprots/Quote/EmployeeQuoteLandscape.rpt")

Has a problem: Reprots

Server.MapPath("~/Content/Reports/Quote/EmployeeQuoteLandscape.rpt")
Begginnerdev 256 Junior Poster

Is the pc on the same network? If so, just use the IP of the host machine.

"Provider=Microsoft.ACE.OLEDB.12.0;Data Source=\\serverName\shareName\folder\myAccess2007file.accdb;"

Here is a wonderful reference for connection strings.

Begginnerdev 256 Junior Poster

Here is a link that may help.

It is written in C#, but the solution has nothing to do with coding.

Begginnerdev 256 Junior Poster

The safest way to do so, if you have not solved the problem, would be to use Properties.

For Example:

Public Class Form1  
    Public Property TextString As String
        Get
            Return TextBox1.Text
        End Get
        Set(value As String)
            TextBox1.Text = value
        End Set
    End Property    
End Class

Public Class Form2
    Private Sub btnSendTo_Click(ByVal sender As Object, ByVal e As EventArgs) Handles btnSendTo.Click
        Form1.TextString = "This is a test."
    End Sub
End Class
TnTinMN commented: something along the lines of great minds think alike ;>) +8