Oxiegen 88 Basically an Occasional Poster Featured Poster

The first thing you need to do is to make sure that the content of both the textboxes are indeed numeric.
The function for that is called IsNumeric and returns a boolean value.

Second. In order to perform any calculations you need to convert the numeric strings in the textboxes. And because you are multiplying with a decimal value, you need to convert them into Double.

So.The calculation would look something like this.

Dim product As Double

If IsNumeric(textbox2.Text) = True Then
    product = CDbl(Val(textbox2.Text)) * 0.75

    If IsNumeric(textbox1.Text) = True Then
        If product <= CDbl(Val(textbox1.Text)) Then
            Shell "notepad", vbNormalFocus
            SendKeys "g152b"
        Else
            Shell "notepad", vbNormalFocus
            SendKeys "cb152b"
    End If
End If

If you need to limit the number of decimals this might produce you can use the Round() function.
product = Round(product, <number of decimals, 0 is default>)

Oxiegen 88 Basically an Occasional Poster Featured Poster

Hmm. I'm not entirely liking the new design.
It's looks enlarged as if you're using the accessibility tools in Windows.
We're not blind or elderly. You can tone down the bloatiness of it. And the font size.
In fact, I liked the previous design better than this, and the one before that even more.
To me it seems to be getting worse and worse every time a new design gets published.

JamesCherrill commented: I'm elderly and part-way to going blind +0
Oxiegen 88 Basically an Occasional Poster Featured Poster

I'm not entirely sure if it's possible to have it both ways.
Allow the server to maintain the established connection between each client talking to each other, but to also establish a direct connection between the clients for sending of messages.

That would permit the server to run that connection timer and send instructions to each client ordering them to terminate the connection to each other. And also for the clients to have that close-to-real-time communication you want.
But it requires each client to run two threads, one listening to the server and the other for talking to the other client.

Oxiegen 88 Basically an Occasional Poster Featured Poster

Do you know for a fact whether or not the recovery partition doesn't contain the factory install of Win7?
If it does you can just find the correct button to press/hold while booting and reset the system.

Otherwise, go right ahead and remove it all.
You can do that during the install of Win7. Just hit the big Custom button and remove any and all partitions from there, and create a new one as you see fit.

Oxiegen 88 Basically an Occasional Poster Featured Poster

Here's the deal.
Practically everything under and including www should be owned by the webserver.
Check the config to see what user the server runs as, and change files and directories using the chown command.
Otherwise the webserver and scripts cannot perform any file or directory action.

You can later on lock it up some using a .htaccess file.

Oxiegen 88 Basically an Occasional Poster Featured Poster

This is a fully working code.
I noticed one thing that caused problems. The column name Size is a reserved word, so you need to put brackets [] around it.

Imports System
Imports System.IO
Imports System.Text
Imports System.Data.OleDb

Public Class frmBirthdayCake
    Private sql As String = "SELECT CakeID,Cake_Name,Cake_Description,Weight,Price,Image,ShelfLife,[Size],NoOfServings FROM Birthday_Cake"
    Private dt As New DataTable
    Private con As New OleDbConnection("Provider=Microsoft.ACE.OLEDB.12.0;Data Source=|DataDirectory|\CakeAlbum.accdb")
    Private adapter As New OleDbDataAdapter(sql, con)
    Dim index As Integer

    Private Sub frmBirthdayCake_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
        con.Open()
        adapter.Fill(dt)

        DataGridView1.DataSource = dt
        DirectCast(DataGridView1.Columns("Image"), DataGridViewImageColumn).ImageLayout = DataGridViewImageCellLayout.Stretch

        For i As Integer = 0 To dt.Rows.Count - 1
            Dim row As DataGridViewRow = DataGridView1.Rows(i)
            row.Height = 60
        Next

        DataGridView1.Columns("Image").Width = 150
        con.Close()
    End Sub

    Private Sub btnNext_Click(sender As System.Object, e As System.EventArgs) Handles btnNext.Click
        If TextBox1.Text = "" Then
            index = 0
        ElseIf index = dt.Rows.Count - 1 Then
            Exit Sub
        Else
            index += 1
        End If

        TextBox1.Text = dt.Rows(index)(0)
        TextBox2.Text = dt.Rows(index)(1)
        ReadImage()
    End Sub

    Private Sub btnPrevious_Click(sender As System.Object, e As System.EventArgs) Handles btnPrevious.Click
        If TextBox1.Text = "" OrElse index = 0 Then
            index = 0
        ElseIf index = dt.Rows.Count - 1 OrElse index <> 0 Then
            index -= 1
        End If

        TextBox1.Text = dt.Rows(index)(0)
        TextBox2.Text = dt.Rows(index)(1)
        ReadImage()
    End Sub

    Private Sub ReadImage()
        Try
            Dim imageBytes() As Byte = CType(dt.Rows(index)(2), Byte())
            Using ms As New MemoryStream(imageBytes)
                PictureBox1.Image = Image.FromStream(ms)
                PictureBox1.SizeMode = PictureBoxSizeMode.StretchImage
            End Using
        Catch ex As Exception

        End Try
    End Sub

    Private Sub DataGridView1_CellMouseClick(sender As Object, e As System.Windows.Forms.DataGridViewCellMouseEventArgs) Handles …
Ashveen96 commented: thanks a lot this works!!! +0
Oxiegen 88 Basically an Occasional Poster Featured Poster

Simple SQL query: SELECT MAX(<column name>) FROM <table>
The MAX() function works with both numbers and strings.
http://msdn.microsoft.com/en-us/library/ms187751.aspx

Oxiegen 88 Basically an Occasional Poster Featured Poster

You need two string variables.

You can perform a line read using the appropriate filereader object and append the line into a temp string variable through a simple loop.
And for each line you can in addition perform some string manipulation.
So for each line the only contains "" or " ", you can skip to the next line so that empty lines do not get read into the permanent string variable.

Additionally, during the manipulation phase you can do a simple string replacement.
:'++' becomes vbNewLine (or vbCrLf) and so on.
By using two variables you can append the last know good string to the "real" string.

The String object contains a whole bunch of useful tools to do exactly what you're asking for.

Oxiegen 88 Basically an Occasional Poster Featured Poster

Just for kicks.
Try putting that code in a separate method and call it from the Load method.
But also include a class boolean variable.

Private bIsLoading As Boolean = True

Private Sub frmcrc_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
    If bIsLoading Then
        LoadValues()
    End If
    bIsLoading = False
End Sub

Private Sub LoadValues()
    'Your code
End Sub

This is just to make sure that the code is not being executed twice.
I've had the happen to me once or twice when I had some code in the Form_Load event.

Oxiegen 88 Basically an Occasional Poster Featured Poster

DIM is the keyword used in Visual Basic to declare a variable.

VB: Dim varname As Object
C#: object varname;

ddanbe commented: ok +15
Oxiegen 88 Basically an Occasional Poster Featured Poster

If you create and add controls through code then those controls will not have any events tied to them.
When you open the second and third panels and create controls in them, you also have to use the AddHandler statement and tie that to the txbUM_KeyDown event, or use a generic event and tie all three textboxes to it using AddHandler.

'For panel 2
AddHandler txbUM2.KeyDown, AddressOf txbUM_KeyDown

'For panel 3
AddHandler txbUM3.KeyDown, AddressOf txbUM_KeyDown

Like that.
And in the event itself you can use sender to identify which textbox triggered the event by using CType.

Dim tbox As TextBox = CType(sender, TextBox)
Oxiegen 88 Basically an Occasional Poster Featured Poster

I cannot speak for all the webhosts in the world.
However, I would say that some webhosts provide such a solution, provided that you register a domain with them.
But most do not. They require that you order the full package of a webspace that includes 5, or more, email addresses.

But to answer your question.
Yes. It's possible.

How about this example? http://www.mailorderworks.co.uk/

Oxiegen 88 Basically an Occasional Poster Featured Poster

Like JorgeM said. Suggestion 4 would be the best bet.
I've never even heard of gtb inspector. :)

Oxiegen 88 Basically an Occasional Poster Featured Poster

Well. It depends.
What kind of proxy server are you running?
MS? Linux? Hardware?

There are several suggestions in this thread, which is a linux based proxy.
And you can also read up on Web Proxy Autodiscovery Protocol.

Oxiegen 88 Basically an Occasional Poster Featured Poster

The question mark (?) was just an indicator telling you to put a numeric value there.
A question mark is also known as an "unknown". :)

Auto is not a property, it's a valid value to simply allow the container to expand depending on whatever the size of the content without regards.

Oxiegen 88 Basically an Occasional Poster Featured Poster

Something like this:

Private Sub CopyToAccess(source As DataTable)
    Try
        Dim connString As String = "Provider=Microsoft.ACE.OLEDB.12.0;Data Source=C:\myFolder\myAccess2007file.accdb;Persist Security Info=False;"

        Dim accConnection As New OleDb.OleDbConnection(connString)
        Dim selectCommand As String = "SELECT <field1>, <field2> and so on FROM <table>"
        Dim accDataAdapter As New OleDb.OleDbDataAdapter(selectCommand, accConnection)

        Dim accCommandBuilder As New OleDb.OleDbCommandBuilder()
        accDataAdapter.InsertCommand = accCommandBuilder.GetInsertCommand()
        accDataAdapter.UpdateCommand = accCommandBuilder.GetUpdateCommand()

        Dim accDataTable As DataTable = source.Copy()

        ''Just to make sure, set the RowState to added to make sure an Insert is performed'
        'For Each row As DataRow In accDataTable.Rows'
        '    If row.RowState = RowState.Added Or RowSate.UnChanged Then'
        '        row.SetAdded()'
        '    End If'
        'Next'

        accDataAdapter.Update(accDataTable)
    Catch ex As Exception
    End Try
End Sub
Oxiegen 88 Basically an Occasional Poster Featured Poster

Here's how you can get an ArrayList of available drives.

Imports System.IO

Public Function GetDrives() As ArrayList
    Dim drives As New ArrayList

    For Each drive As DriveInfo In My.Computer.FileSystem.Drives
        drives.Add(drive.Name)
    Next

    Return drives
End Function
Oxiegen 88 Basically an Occasional Poster Featured Poster

I'm assuming that you're looking for the SQL expression to accomplish this.
Here it is:
SELECT tblData.num,SUM(tblData.cost) AS Total,tblPrize.prize FROM tblData, tblPrize WHERE tblData.num = tblPrize.num GROUP BY tblData.num

Oxiegen 88 Basically an Occasional Poster Featured Poster

I've been successful in using IO.File.Copy when transfering files to and from another computer.
IO.File.Copy("\\" & cmbservername1.Text & "\SharedNow\database.txt", "C:\database.txt")

Oxiegen 88 Basically an Occasional Poster Featured Poster

You should make it a rule to include an ID field and make it a Primary Key when creating tables in a database.
And also include that in your SELECT statements.

That's why you get that message.

Oxiegen 88 Basically an Occasional Poster Featured Poster

Try setting the mdiparent of that second form to the MDI form.

mastersupplier.MdiParent = <name of mdi form>
Oxiegen 88 Basically an Occasional Poster Featured Poster

This is how you set the orientation to landscape.

Dim settings As New System.Drawing.Printing.PrinterSettings
settings.DefaultPageSettings.Landscape = True 'This is the key

'And to retain those margins you're setting
settings.DefaultPageSettings.Margins = New Margins(10, 10, 10, 10)

PrintDocument1.PrinterSettings = settings
Oxiegen 88 Basically an Occasional Poster Featured Poster

Alright.
You want to convert the text into HTML entities.

This function should do it:

Private Sub SomeMethod()
   Dim file As New StreamReader("filename", Encoding.GetEncoder(437))
   Dim content As String
   content = TextToHtmlEntity(file.ReadToEnd)
   file.Close()

   'content now contains a string of HTML entities
End Sub

Private Function TextToHtmlEntity(ByVal text As String) As String
   Dim textVal As Integer
   Dim encoded As String = ""
   Dim c As Char

   For Each c In text
      textVal = AscW(c)
      If textVal >= 49 And textVal <= 122 Then
         encoded += c
      Else
         encoded += String.Concat("&#",
textVal.ToString(System.Globalization.NumberFormatInfo.InvariantInfo), ";")
      End If
   Next

   Return encoded
End Function
Oxiegen 88 Basically an Occasional Poster Featured Poster

You can use the MouseMove event and check if the mouse pointer is within the Bounds of the stripmenu item.
If that's the case, simply change the BackgroundColor.

Private Sub menuitem1_MouseMove(ByVal sender As Object, ByVal e As MouseEventArgs)
        If menuitem1.Bounds.Contains(e.Location) Then
            menuitem1.BackColor = Color.Beige
        Else
            menuitem1.BackColor = Color.White
        End If
    End Sub
SeniorAlexandro commented: Thank you. +1
Oxiegen 88 Basically an Occasional Poster Featured Poster

Have you tried using HttpWebResponse.ResponseUri?

Dim response As HttpWebResponse
Dim resUri As String

response = request.GetResponse
resUri = response.ResponseUri.AbsoluteUri
Oxiegen 88 Basically an Occasional Poster Featured Poster

I'm using a single method for resizing images in both directions.
It returns a BitMap object that you can use on wherever you like.

public BitMap ResizeBitMap(BitMap source, Size newSize)
{
   //Get the source bitmap
   BitMap bm_source = source;

   //Create a bitmap for the result
   BitMap bm_dest = new BitMap(newSize.Width, newSize.Height);

   //Create a Graphics object for the resulting BitMap
   Graphics gr_dest = Graphics.FromImage(bm_dest);

   //Copy the source image into the destination bitmap
   gr_dest.DrawImage(bm_source, 0, 0, bm_dest.Width + 1, bm_dest.Height + 1);

   //Return the result
   return bm_dest;
}

Here is one way of how you can use it:

private void someMethod()
{
   BitMap resizedImage = ResizeBitMap(loadedImage, new Size(loadedImage.Width * .9, loadedImage.Height * .9));

   //Stick that resized bitmap anywhere you like it.
   //For example a PictureBox
   pictureBox1.Image = resizedImage;
}
Oxiegen 88 Basically an Occasional Poster Featured Poster

Do you remember the connection string I gave you in your previous post "Need Help"?
Try using that one instead.

If I recall correctly, the constant DATA_SOURCE already contains "data source=JAKE-PC\SQLEXPRESS", so what you have done in your StingBuilder is declare the data source twice.
It's redundant, and causes errors.

And, the format of your connection string is targeted towards MSSQL 2005/2008.
Try using "Integrated Security=SSPI" instead of "trusted_connection=yes;".

Oxiegen 88 Basically an Occasional Poster Featured Poster

If you wanna move or copy files from one location to another using your program, there are easier ways than using FileStream.

Imports System.IO

    Private Sub FileCopy()
        Dim strFileSource As String = "C:\Temp\sourceFile.txt"
        Dim strFileDestination As String = "C:\Temp\destinationFile.txt"

        File.Copy(strFileSource, strFileDestination)
    End Sub

    Private Sub FileMove()
        Dim strFileSource As String = "C:\Temp\sourceFile.txt"
        Dim strFileDestination As String = "C:\Temp\destinationFile.txt"

        File.Move(strFileSource, strFileDestination)
    End Sub

    Private Sub CopyMoveMultipleFiles()
        Dim strSourceDirectory As String = "C:\Temp"
        Dim strDestinationDirectory As String = "C:\SecondaryTemp"
        Dim di As New DirectoryInfo(strSourceDirectory)

        'To copy files
        For Each fi As FileInfo In di.GetFiles
            fi.CopyTo(strDestinationDirectory & "\" & fi.Name)
        Next

        'To move files
        For Each fi As FileInfo In di.GetFiles
            fi.MoveTo(strDestinationDirectory & "\" & fi.Name)
        Next
    End Sub
Oxiegen 88 Basically an Occasional Poster Featured Poster

You should consider moving that code onto a button click event.
Otherwise the query will be fired for every keystroke you use in the textbox.

And you are very close to the solution, my friend. :)
Notice my lack of use of the SqlConnection object. It will work anyway, because the SqlDataAdapter will take care of connecting to the database. If provided with the connection string.

The SqlCommandBuilder will help take care of creating INSERT, UPDATE and DELETE statements for you.

Private bindingSource1 As New BindingSource

Private Sub Form1_Load(ByVal sender As Object, ByVal e As EventArgs) Handles MyBase.Load
   AuthorsGridView.DataSource = bindingSource1
End Sub

Private Sub TextBoxId_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles TextBoxIdSearchExist.TextChanged
   Try
      da = New SqlDataAdapter("SELECT * FROM pay WHERE t_id = '" & tId.Text & "'", <your connection string>)
      Dim builder As New SqlCommandBuilder(da)
      da.Fill(ds, "pay") 'Needs to be the name of the source table
   
      'I don't know what GetData(queryString) is for, so I'm ignoring it
      If ds.Tables.Count > 0 Then
         bindingSource1.DataSource = ds.Tables(0)
      Else
         MessageBox.Show("No results found in database.")
      End If
   Catch ex As Exception
      MessageBox.Show("Unable to connect to database, or an error occured.")
   End Try
End Sub
kingsonprisonic commented: Nice !! +1
Oxiegen 88 Basically an Occasional Poster Featured Poster

You could use the method GetProcessesByName in order to determine if a certain process is running.
It returns an array of processes containing all instances of a certain named process, for example "wmplayer".
If the Length of the array is greater than 0, then that particular process is running.
This snippet also eliminates the need for ListBoxes and things like that.

If GetProcesses("wmplayer") > 0 Then
   textbox.Text = textbox.Text & Environment.NewLine & "     -> Windows Media Player"
End If

Private Function GetProcesses(nameOfProcess As String) As Integer
   Dim namedProcess As Process() = Process.GetProcessesByName(nameOfProcess)
   Return namedProcess.Length
End Function
Oxiegen 88 Basically an Occasional Poster Featured Poster

In addition to adding the reference to Microsoft Outlook 14, make sure that you also import the namespace Microsoft.Office.Interop.

Then you can use this code to create a mail message.

Dim oApp As New Outlook.Application()
Dim oMsg As Outlook.MailItem

oMsg = oApp.CreateItem(Outlook.OlItemType.olMailItem)
oMsg.To = "reciever@domain.com"
oMsg.Subject = "mail subject"
oMsg.Body = "simple mail body text"
'' OR
'oMsg.HTMLBody = "html mail body text"

oMsg.Send()

'Optionally also use:
'oMsg.Display()
debasisdas commented: agree +13
Oxiegen 88 Basically an Occasional Poster Featured Poster

Yes, I would revise that code into something like this.

Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
   Dim playerdrivers As New ArrayList
   Dim destination As String = Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData) + "\f1data\bin\array.txt"
   Dim FileReader1 As New StreamReader(destination)
   Dim Contents1 As String
   Dim index As Integer = 0

   While FileReader1.Peek <> -1
      Contents1 = FileReader1.ReadLine
      Dim array As New ArrayList
      array.AddRange(Contents1.Split(","))
      playerdrivers.Add(array)
   End While

   FileReader1.Close()

After that you can easily access each player and driver using almost the same method as you intended:
playerdrivers(0).Item(0) - playerdrivers(0).Item(5)
playerdrivers(1).Item(0) - playerdrivers(1).Item(5)

djjavo commented: Very helpful. +0
Oxiegen 88 Basically an Occasional Poster Featured Poster

Why not convert the method into a function that returns a string.
And then enclose the code in a Try...Catch statement.
If the code should fail, then you can return the .ToString() of the exception object and examine what went wrong.
Otherwise you just return an empty string.

swathys commented: tq +0
Oxiegen 88 Basically an Occasional Poster Featured Poster

In order to add names from the database to the combobox you can more or less use the same code as for the search. Observe the change in the SQL string.

Dim ConStr As String = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=C:\Documents and Settings\~LaiLi~\My Documents\Visual Studio 2005\Projects\MoreWever\MoreWever\bin\Debug\Inventory.mdb"
        sql = "SELECT * FROM Profile"
        con.Open()
        Dim cmd As OleDbCommand
        Dim dr As OleDbDataReader

        cmd = New OleDbCommand(sql, con)
        dr = cmd.ExecuteReader

        While dr.Read()
            If Not StudNameComboBox.Items.Contains(dr("StudName")) Then
               StudNameComboBox.Items.Add(dr("StudName"))
            End If
        End While

        dr.Close()
        con.Close()

The IF NOT statement makes sure that no duplicate names are added.

Oxiegen 88 Basically an Occasional Poster Featured Poster

You can change the original cmd.CommandText text so that you incorporate both the insert and the select query using the EXISTS condition.
Like so:

cmd.CommandText = "INSERT INTO tbl_curriculum (course_code,subj_code) VALUES ('" & txtCode.Text & "','" & txtScode.Text & "') WHERE NOT EXISTS (SELECT subj_code FROM tbl_curriculum WHERE subj_code = '" & txtScode.Text & "')"

This will both save you some coding and also get rid of that IF statement.

debasisdas commented: effective solution. +9
Oxiegen 88 Basically an Occasional Poster Featured Poster

Ok.
You can expand this part of the code to include the marked code I provided:

'Gather a list of items in folder, then remove file path, then display items
Dim FilesInDir As String() = Directory.GetFiles(".\Folder", "*.txt", SearchOption.AllDirectories)
Dim SFile As String

ListView1.Items.Clear()
For Each SFile In FilesInDir
	ListView1.Items.Add(New ListViewItem(New String() {SFile.Replace(".\Folder\", ""), CStr(FileLen(SFile))}))

	'' --------- Add This Code ----------
	Dim stream As New FileStream(".\Folder\" & SFile, FileMode.Open, FileAccess.Read)
	Dim reader As New StreamReader(stream)
	Dim line As String = reader.ReadLine 'This is just to skip the first line in the file

	'Change the number 5 value to match the number of lines to read from the file
	'If only one line is to be read, then remove the For...Next statement but keep what's in it.
	For i As Integer = 1 To 5
		'First check to see if the end of the file is reached
		If Not reader.EndOfStream Then
			'Read the next line from the file
			line = reader.ReadLine
			'Add the line to the SubItems collection of the last added item in the ListView
			ListView1.Items(ListView1.Items.Count - 1).SubItems.Add(line)
		End If
	Next

	reader.Close()
	'' --------- End of Added Code ----------
Next
Smalls commented: Was very Helpful. tweaked it a lil to fit my needs. thank again +3
Oxiegen 88 Basically an Occasional Poster Featured Poster

Perhaps you could check to see if WinZip support command line arguments.
If that is the case, then you can probably perform a standard extraction to a folder you choose.
Then you can use Process.Start() to run that EXE file.

If that is NOT the case, then you can check out this Add-On for WinZip, which enables it to support command lines.
http://www.winzip.com/prodpagecl.htm

Oxiegen 88 Basically an Occasional Poster Featured Poster

All you need to do is to reformat the query into an UPDATE query.
Like so:

Dim cmd As New OleDbCommand("UPDATE tblPurchase_Order SET " _
"[Supplier_Id] = @Supplier_Id, [Address] = @Address, [Project_Id] = @Project_Id, " _
"[dtpDate] = @dtpDate, [Material_Id] = @Material_Id, [Material_Name] = @Material_Name, _
"[Unit] = @Unit, [Quantity] = @Quantity, [Unit_Price] = @Unit_Price, " _
"[Amount] = @Amount WHERE [Order_Id] = @Order_Id")

cmd.Connection = conn
cmd.CommandType = CommandType.Text
cmd.Parameters.AddWithValue("@Order_Id", lstItems.Items(i).SubItems(0).Text)
cmd.Parameters.AddWithValue("@Supplier_Id", lstItems.Items(i).SubItems(1).Text)
cmd.Parameters.AddWithValue("@Address", lstItems.Items(i).SubItems(2).Text)
cmd.Parameters.AddWithValue("@Project_Id", lstItems.Items(i).SubItems(3).Text)
cmd.Parameters.AddWithValue("@dtpDate", lstItems.Items(i).SubItems(4).Text)
cmd.Parameters.AddWithValue("@Material_Id", lstItems.Items(i).SubItems(5).Text)
cmd.Parameters.AddWithValue("@Material_Name", lstItems.Items(i).SubItems(6).Text)
cmd.Parameters.AddWithValue("@Unit", lstItems.Items(i).SubItems(7).Text)
cmd.Parameters.AddWithValue("@Quantity", lstItems.Items(i).SubItems(8).Text)
cmd.Parameters.AddWithValue("@Unit_Price", lstItems.Items(i).SubItems(9).Text)
cmd.Parameters.AddWithValue("@Amount", lstItems.Items(i).SubItems(10).Text)
Oxiegen 88 Basically an Occasional Poster Featured Poster

There are several ways to connect to a database on another computer.
If the database is on a Microsoft SQL Server, then you have the System.Data.SqlClient namespace.
If the database is an Access database, then you have the System.Data.OleDb namespace.

So, assuming the the database is an MS SQL Server then this is one way to connect to it.

Imports System.Data.SqlClient

Private Sub UpdateDatabase()
   Dim con As New SqlConnection("Data Source=computer2; Initial Catalog=thedatabase; User ID=billybob; Password=hamburger;")
   Dim com As SqlCommand = Nothing

   Try
      con.Open()
      com = New SqlCommand("UPDATE table SET col2=@p2 WHERE col1=@p1", con)
      com.Parameters.AddWithValue("@p1", 365)
      com.Parameters.AddWithValue("@p2", "Hello World")
      com.ExecuteNonQuery()
      con.Close()
   Catch ex As Exception
      If con.State = ConnectionState.Open Then
         con.Close()
      End If
   End Try
End Sub

For an Access database, the equivalent would be this:

Imports System.Data.OleDb

Private Sub UpdateDatabase()
   'MS Access 97-2003
   Dim con As New OleDbConnection("Provider=Microsoft.Jet.OLEDB.4.0;Data Source=\\computer2\sharedfolder\mydatabase.mdb;User Id=admin;Password=;")
   'MS Access 2007
   Dim con As New OleDbConnection("Provider=Microsoft.ACE.OLEDB.12.0;Data Source=\\computer2\sharedfolder\myAccess2007file.accdb;Persist Security Info=False;")

   Dim com As OleDbCommand = Nothing

   Try
      con.Open()
      com = New OleDbCommand("UPDATE table SET col2=@p2 WHERE col1=@p1", con)
      com.Parameters.AddWithValue("@p1", 365)
      com.Parameters.AddWithValue("@p2", "Hello World")
      com.ExecuteNonQuery()
      con.Close()
   Catch ex As Exception
      If con.State = ConnectionState.Open Then
         con.Close()
      End If
   End Try
End Sub
kvprajapati commented: :) +10
Oxiegen 88 Basically an Occasional Poster Featured Poster

I don't know how they can be magically converted to binary on their own.
If you create and save a file in Random mode, then they should be read in Random mode. Also, if you create and save in Binary mode, then you should read them in Binary mode.

However, perhaps the error is occuring because of Records = LOF(FF) | Len(TOPFILE).
Consider the fact that the length of some objects has a zero-based index.
So, the line could be rewritten as: Records = (LOF(FF) | Len(TOPFILE)) - 1

Oxiegen 88 Basically an Occasional Poster Featured Poster

Ah. Now I see.
Ok, try this:

If TopRecords > 0 Then
   Rec = 1
   Do While Not EOF(FF)  '<<--- Replace the For loop with this While loop
      'UPGRADE_WARNING: Get was upgraded to FileGet and has a new behavior. 
      FileGet(FF, TopData, Rec) 
      '
      If TopData.Deleted = True Then
         TopData.ExcelRecord = 0
         TopData.DataSheet = ""
         TopData.TopName = ""
         TopData.TopDate = ""
         TopData.ExcelJobName = ""
         TopData.PipeRecap = ""
         TopData.Catagory = 0
         '
         For X = 0 To 19
            TopData.TopProperties(X) = 0
         Next X
         '
         TopData.Catagory = 0
         TopData.Status = 0
         '
         'UPGRADE_WARNING: Put was upgraded to FilePut and has a new behavior. 
         FilePut(FF, TopData, Rec)
      End If
      '
      Rec += 1
   Loop
End If
Simran Kaur commented: was very helpful & thoughtful +1
Oxiegen 88 Basically an Occasional Poster Featured Poster

You should look into the uses of StreamReader and StreamWriter.

'Reading files
Private Sub ReadFile(Filename As String)
   Dim stream As New IO.FileStream(Filename, IO.FileMove.Open)
   Dim sr As New IO.StreamReader(stream)
   Dim line As String = ""

   While sr.Peek <> -1  'Read until EOF
      line = sr.ReadLine
   End While
   sr.Close()
   stream.Close()
End Sub

'Writing to files
Private Sub WriteFile(Filename As String)
   Dim stream As New IO.FileStream(Filename, IO.FileMode.Create)
   Dim sw As New IO.StreamWriter(stream)

   sw.WriteLine("Here's some text to write on a line") 'Automatic linebreak in file
   sw.Flush()
   sw.Close
   stream.Close()
End Sub
Simran Kaur commented: was helpful +1
Oxiegen 88 Basically an Occasional Poster Featured Poster

Your code would work perfectly if you manually populated the DataGridView.
But because the grid is databound, any changes to the grid layout, ie a new column, will result in an error because that column is not part of the original database table.
The error occurs because the change in the datagrid will trigger an event in the grid to perform a change in the underlying datatable.

Now, if you add a boolean column to the datatable before binding it to the datagrid, then the checkbox column will be shown, and any changes to it will not result in error.

Try
  cmd.CommandText = "SELECT *" & _
  "FROM oracle database 

  Dim da As New OracleDataAdapter(cmd)
  Dim DMdt As New DataTable
  da.Fill(DMdt)

  If DMdt.Rows.Count > 0 Then
    DMDt.Columns.Add(New DataColumn("Part", GetType(Boolean)))

    Me.DataGridView1.DataSource = DMdt
    'filter the datatable
    da.Dispose()
Oxiegen 88 Basically an Occasional Poster Featured Poster

It is not possible to assign a method to a variable like that.
But you can create a class that holds all those methods, where you tell the constructor which method to execute.
Like this:

Public Class Methods
   Private strMethodName As String
   Private objVar1 As Object
   Private objVar2 As Object

   Public Sub New(NameOfMethod As String)
      Me.strMethodName = NameOfMethod
   End Sub

   Public Function Method(Var1 As Object, Var2 As Object) As Object
      objVar1 = Var1
      objVar2 = Var2

      Select Case strMethodName
         Case "method1":
            Return method_1()
         Case "method2":
            Return method_2()
         'And so on
         Else
            Return method_n()
      End Select
   End Function

   Private Function method_1() As Object
      'Do something with var1 and var2
      Return result
   End Function

   Private Function method_2() As Object
      'Do something else with var1 and var2
      Return result
   End Function

   Private Function method_n() As Object
      'Do something else with var1 and var2
      Return result
   End Function
End Class

Then do this in your code:

'This is your code
Dim clsMethods As Methods
If radiobutton1.checked = true then
   clsMethods = New Methods("method1")
ElseIf radiobutton2.checked = true then
   clsMethods = New Methods("method2")
Else
   clsMethods = New Methods("method3")
End If

For i = 0 To 1000
   Dim value As Object = clsMethods.Method(var1, var2)
   'Do something with the value
Next
Oxiegen 88 Basically an Occasional Poster Featured Poster

You can try this.
Put a button of your form and call it btnImport.
Then add this code.

Private Sub btnImport_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnImport.Click
        Dim fileName As String = ""

        Dim ofd As New OpenFileDialog
        If ofd.ShowDialog = Windows.Forms.DialogResult.OK Then
            fileName = ofd.FileName
            PerformImportToSql(fileName)
        End If
    End Sub

    Private Sub PerformImportToSql(ByVal Filename As String)
        Dim table As DataTable = New DataTable
        Dim accConnection As New OleDb.OleDbConnection("Provider=Microsoft.JET.OLEDB.4.0; DataSource=" & Filename & ";User Id=admin; Password=;")
        Dim sqlConnection As New SqlClient.SqlConnection("Data Source=yourServer; Initial Catalog=yourDatabase; User Id=yourUsername; Password=yourPassword;")

        Try

            'Import the Access data
            accConnection.Open()

            Dim accDataAdapter = New OleDb.OleDbDataAdapter("SELECT * FROM <tablename>", accConnection)
            accDataAdapter.Fill(table)
            accConnection.Close()

            'Export to MS SQL
            sqlConnection.Open()
            Dim sqlDataAdapter As New SqlClient.SqlDataAdapter("SELECT * FROM <tablename>", sqlConnection)
            Dim sqlCommandBuilder As New SqlClient.SqlCommandBuilder(sqlDataAdapter)
            sqlDataAdapter.InsertCommand = sqlCommandBuilder.GetInsertCommand()
            sqlDataAdapter.UpdateCommand = sqlCommandBuilder.GetUpdateCommand()
            sqlDataAdapter.DeleteCommand = sqlCommandBuilder.GetDeleteCommand()
            sqlDataAdapter.Update(table)
            sqlConnection.Close()
        Catch ex As Exception
            If accConnection.State = ConnectionState.Open Then
                accConnection.Close()
            End If
            If sqlConnection.State = ConnectionState.Open Then
                sqlConnection.Close()
            End If
            MessageBox.Show("Import failed with error: " & Environment.NewLine & Environment.NewLine _
            & ex.ToString)
        End Try
    End Sub
Oxiegen 88 Basically an Occasional Poster Featured Poster

First.
In the form load event, add this line: targetPictureBox.AllowDrop = True

For the source picturebox, add this method:

Private Sub sourcePictureBox_MouseDown(ByVal sender As Object, ByVal e As MouseEventArgs) Handles sourcePictureBox.MouseDown
   Dim pic As PictureBox = DirectCast(sender, PictureBox)
   pic.DoDragDrop(pic.Image, DragDropEffects.Move)
   ' Or if you prefer to just copy the picture
   'pic.DoDragDrop(pic.Image, DragDropEffects.Copy)
End Sub

For the target picturebox, add these two methods:

Private Sub targetPictureBox_DragEnter(ByVal sender As Object, ByVal e As System.Windows.Forms.DragEventArgs) Handles targetPictureBox.DragEnter
   If e.Data.GetDataPresent(DataFormats.Bitmap)
      e.Effect = DragDropEffects.All
   End If
End Sub

Private Sub targetPictureBox_DragDrop(ByVal sender As Object, ByVal e As System.Windows.Forms.DragEventArgs) Handles targetPictureBox.DragDrop
   If e.Data.GetDataPresent(DataFormat.BitMap) Then
      Dim img As BitMap = e.Data.GetData(DataFormats.BitMap)
      'Insert comparison code here
      targetPictureBox.Image = img
   End If
End Sub
Oxiegen 88 Basically an Occasional Poster Featured Poster

My bad.
I forgot to include the Software node. And I just read that registry settings for 32bit programs running on Windows x64 are stored in yet anothor subnode.

Try this path: Microsoft.Win32.RegistryKey rk = Microsoft.Win32.Registry.LocalMachine.OpenSubKey("\\Software\\Microsoft\\Windows\\WOW6432node\\CurrentVersion\\Uninstall");

kvprajapati commented: Solved!!! +10
Oxiegen 88 Basically an Occasional Poster Featured Poster

If the file you're trying to read is a textfile, then you can use the TextReader's ReadLine method.

Try this and see if it helps.

TextReader reader = New StreamReader("<file to read>");
string line = "";

int startReadingHere = <enter line number here>;
int lineIndex = 0;
int readLines = 0;

while (reader.Peek() != -1)
{
   if (lineIndex >= startReadingHere && readLines < 10)
   {
      line = reader.ReadLine();
      //Do something with the string
      readLines += 1;
   }
   lineIndex += 1;
}
Geekitygeek commented: my thoughts exactly :) +1
Oxiegen 88 Basically an Occasional Poster Featured Poster

Add Environment.NewLine after each body line.
A better way would be to do this:

Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnSend.Click
    Dim strSubject As String 'subject title
    Dim strBody As String 'Body of message

    strSubject = "Need Remote Pc Help" 'store subject in variable

    'store body in variable
    strBody = "Here is All the Information that you will need:" & Environment.NewLine
    strBody &= txtName.Text & Environment.NewLine
    strBody &= txtAddress.Text & Environment.NewLine
    strBody &= txtPhone.Text & Environment.NewLine
    strBody &= txtProblem.Text & Environment.NewLine
    strBody &= txtIP.Text

    Dim mail As New System.Text.StringBuilder
    strSubject = "?subject=" & strSubject

    mail.Append("mailto:backstback@hotmail.com") 'email address

    mail.Append(strSubject) 'subject
    mail.Append(strBody) 'body of message
    SendMail(mail.ToString)
End Sub
Oxiegen 88 Basically an Occasional Poster Featured Poster

A field in the SQL Select query with a datatype of Bit should give you a checkbox in the DataGridView.