Mr.M 89 Future Programmers

Ok as towards your first post you have found the solution but it not graphically so why don't you take that consol app and intergrate it VB so that it will still do what it suppose to do but now intead of typing commands on a console the app will do it for you, you will only wright codes once but can use it as many times as you wish.

Mr.M 89 Future Programmers

Well now I've spotted from your image you just posted, the error is because you have turned on the "Option Strict On" here on my VS I didn't turn that on so why don't you comment it and run it. The error is clear, and if I had turned that on I would have posted it together with the codes. Nothing wrong here, you just turned the Option Strict On" and claim the code is wrong, mmmm making sense and I must say I don't usually turn that on, but it work perfectly.

Mr.M 89 Future Programmers

@Jim ok fine, why don't you copy the code as I've posted and test it, you will see the results from the message box. Please capture for me the output and post it back than we can argue about it.

Mr.M 89 Future Programmers

Note that I've Declared k as integer

Mr.M 89 Future Programmers

I've tested it working. Test it and see. The

 K = 0 To recno.ToString

Means the for each k number from 0 to the value that is held by recno. Keep in mind that the Variable is already declared as Integer so that counting will be possible as it is not possible if its a string so the .Tostring means to the value that is contained by the variable. Test it then judge.

Mr.M 89 Future Programmers

I will also agree with JIM you are also saying something different and you are doing something different then what you said. Do it like this

Dim recno As Integer
recno = 4
Dim k As Integer
For k = 0 to recno.Tostring
MsgBox("This is k: " & k)
Next

This will produce a message from 0 to 4 that means it will produce 5 messages, then what you can do is replace the

MsgBox("This is k: " & k)

With your code to access sql also don't forget to close the connection.

Hope this help you.

Mr.M 89 Future Programmers

Try closing the connection because you keep trying to open the connection while it still opened so close the connection so that it will re open the connection.

Mr.M 89 Future Programmers

Try thisMe.Text = "ver " & Me.GetType.Assembly.GetName.Version.ToString

Mr.M 89 Future Programmers
Mr.M 89 Future Programmers

If you have 2 forms on you can create the variables that will hold the connection, data and pass it to the second form and perform the edit method from there, or simple on the first form if you click the record you want to edit and click your edit button you can pass the record to the second form and on the second form you will need to open connection and use the record info to edit the correct record.

Mr.M 89 Future Programmers

If your question has been answered please mark it answered. Thank you.

Mr.M 89 Future Programmers

What I think is that move all the calculation above the "line 31. Dim row As String
() = New String()" because what I see is that before you calculate the BegValue you add everything to a database and the just below or after you added things to the database you then calculate the BagValue so as you save it, it has the Cost values so to get the correct results also try to remove this assign BegValue = Cost just use cost straight there because you used twice begvalue and only use it here:" line 42. BegValue =
EndValue" and see.

Mr.M 89 Future Programmers

No that was to show how to start and it was just a sample he could change from creating a file and go with Setting, I was just showing him because he's seem to be lost.

Mr.M 89 Future Programmers

This is so very simple. On your Main form on it Form_Load try this.

Dim firsttime As String = "done"
' Check from file if the file exist or not, if the file
' Exist that means the program is not running the first time
If My.Computer.FileSystem.FileExist("C:\firsttime.txt")
Then
Me.show()
Else
My.computer.FileSystem.WriteAllText("C:\firsttime.txt", firsttime, True)
Me.Hide()
'Call the form2 as Setting form
Form2.show()
End If

Mr.M 89 Future Programmers

You can try this www.dreamincode.net/forums/topic/300487-creating-sql-server-stored-procedures-and-using-them-in-vbnet/

Mr.M 89 Future Programmers

If your problem has solved Please mark this thread as solved and if you have additional question please start a new thread.

Mr.M 89 Future Programmers

I'm not clear with your question but I think you want to close the selected button off which was the button that you created using the codes you posted above am I right? If so then please see this you will then need a way to trace your buttons because in this case I had a visual buttons on my interface ruther than you in which it will be created an run mode.

Mr.M 89 Future Programmers

Well your situation is a bit complicated since I find it harder to remove the created button so I then decided to add a timer to force the control to remove the UGB so you can do it like I did below in the codes hope it will answer your question.

Public Class Form1
    Dim TC As Integer
    Dim NT As New Button
    Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
        Dim TCP As New Integer

        If Button1.Text = "Create" Then
            TC = TC + 1
            TCP = TC * 100
            NT.Anchor = AnchorStyles.Top And AnchorStyles.Left
            NT.Enabled = True
            NT.Location = New Point(TCP, 85)
            NT.Size = New Size(100, 30)
            NT.Visible = True
            Controls.Add(NT)
            Button1.Text = "Close"
            Timer1.Stop()
        Else
            If Button1.Text = "Close" Then
                Button1.Text = "Create"
                Timer1.Start()
            End If
        End If

    End Sub

    Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
        Button1.Text = "Create"
    End Sub

    Private Sub Timer1_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer1.Tick
        Controls.Remove(NT)
    End Sub
End Class
Mr.M 89 Future Programmers

The simple way is to just count the total datetime then add it on a CountDownBox on properties then you will need to trace the shutdown events so that even if you close the program but it will keep a record of the last count before it shutdown so when you re-run it, it will then read the time from the disc. but let me first show you how I done this all. let say you want to count the 24Hours so if your timer will fire in minutes (1000) interval then here is how you count it. We know that you will be using the minutes so you start from 1000 x 60 x 24 = 1440000 so you will put the 1440000 to the properties of the CountDownBox then on your timer interval should be 1000 not 100 unless you counted from 100 not 1000 and your timer code will be like this

Private Sub Timer1_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer1.Tick
CountDownBox.Text = CountDownBox.Text - 1
If CountDownBox.text = 0 Then
Timer1.stop()
Else
' Do Nothing ather then Counting down
CountDownBox.Text = CountDownBox.Text - 1
End If
End Sub

then you have to track the shutdown events so that when you have close and rerun it wont start over and over again when ever you re-run the program. Hope I answered your Question.