echo ("<b>Your Total Income is $dtotal</b>"); <!--here you have a typo-->
$dtotal is undefined, $total is defined. If you fix that one typo it might fix the problem.
echo ("<b>Your Total Income is $dtotal</b>"); <!--here you have a typo-->
$dtotal is undefined, $total is defined. If you fix that one typo it might fix the problem.
I know that I worked (and still do) very hard to learn how to code a program from requirements and I feel like some of the other posters above that people who REFUSE to even try to learn to write a simple program shouldn't be getting any kind of programming degree. The FizzBuzz comment was especially valid. What is the requirements of the program? You have to fill an array and then search that array for the number of elements greater than a search value...seriously, put the pencil to the paper or the fingers to the keys and think about what needs to be coded and write some code and then post it here and maybe you can get some help. Show that you want to learn and people will be MUCH more willing to help you.
Not to be judgemental or anything, but this subject interested me so I did a short search on it and I found multiple ways using system information files and registry techniques to do just this thing--and it took me maybe a couple minutes to find the information...
I can tell you this though. If you want to use a program to hide a file from a user you could change the attributes of it like this: (this is an about.txt file in the installation directory, for instance)
IO.File.SetAttributes(Application.StartupPath + "\Resources\About.txt", IO.FileAttributes.ReadOnly = 1) 'ReadOnly = 1 makes the file -s (SYSTEM) and -h (HIDDEN) so it would not be easy to find.
Anyway, to use an application to hide itself is an interesting thing, but you would have to design it to run with administrative privileges and that is another subject altogether (I think).
And, FYI, I am pretty sure that VB.Net is verbose enough to accomplish something like this if you know the right code and put in enough time and effort into finding your solution. Hopefully you don't want to do this for negative reasons, but, either way, it should be a fun learning process.
If you post your actual code it would make it a lot easier to understand what your problem might be.
And here's a quick alteration I did to show how you could parse out spaces. You could use this same kind of technique to parse out anything you don't want as input:
Public Class Form1
Private Sub Button1_Click(sender As System.Object, e As System.EventArgs) Handles Button1.Click
Dim num_len As Integer = 0 ' set by length of whole numbers
Dim per_len As Integer = 0 ' set by length of decimal numbers
Dim str_input As String = TextBox1.Text ' holds user input provided from MaskedInputBox
Dim _Count As Integer = str_input.Length ' total provided input string length
Dim str_number(_Count) As String ' maybe the length is all whole numbers?
Dim str_Decimal As String ' Same as above
Dim str_Percent(_Count) As String ' maybe the length is all decimal numbers? Holds numbers after "." is found
For X As Integer = 0 To _Count - 1 ' Parse the whole numbers out now
If (str_input(X) <> "." And str_input(X) <> " ") Then ' Parse the whole numbers and remove spaces then the decimal point
str_number(X) = str_input(X)
ElseIf (str_input(X) = ".") Then
num_len = X ' whole numbers equals how many iterations before we found "."
GoTo PARSE_POINT
End If
If (0 = 1) Then
PARSE_POINT:
str_Decimal = str_input(X) ' 'parse the decimal point out now
Dim dec_place As Integer = X ' the decimal point is found where the 'X' For stopped iterating to come here
For Y As Integer = 0 To (_Count - (X + 1)) ' …
Here is the solution to your problem. First, to solve the conundrum presented by DDanbe, you need to use a MaskedTextbox and set a custom mask using as many numbers and you want on the left then a decimal point and then as many as you want on the right. If you don't know how to do this then look it up. Next you have to parse the input from string to strings to numbers to number like so:
Notably, the code is ugly because I wrote it fast for an example, but it works (and that's what matters). Check it out and it will show you how to parse input to validate that you have a double and then use that double in some way (I used a msgbox to display it). Anyway, hope this helps.
Private Sub Button1_Click(sender As System.Object, e As System.EventArgs) Handles Button1.Click
Dim num_len As Integer = 0 ' set by length of whole numbers
Dim per_len As Integer = 0 ' set by length of decimal numbers
Dim A As Integer = 0 ' place holder
Dim str_input As String = TextBox1.Text
Dim _Count As Integer = str_input.Length
Dim str_number(_Count) As String ' I don't know big of a number you want to go up to
Dim str_Decimal As String ' Same as above
Dim str_Percent(_Count) As String ' Use this to hold numbers after the "."
For X As Integer = 0 To _Count - 1 ' Parse the whole numbers …
The myCommand.ExecuteNonQuery() line is what updates the database. This event handler is pretty small. Have you tried debugging it with breakpoints line by line and watching what happens at each line. This might give you a better idea of where it gets off track.
I'm not sure exactly what you're asking, but if you wanted to click a button with a sub procedure or function or another event handler, or whatever, then you need to use the Object.PerformClick() procedure. Let's say that you have a button called btnStart and you want it to click when your form loads. In your form load event handler you would place this--> btnStart.PerformClick()
I hope that helps.
You have nothing wrong with your code that I can find. I copy/pasted your code and changed the connection string to connect to .accdb instead of .mdb and it ran perfectly. I created quick test Db and a windows form with just the 1 button and it ran. Below is the working code as it worked on my machine less than 1 minute ago:
Public Class Form1
Private Sub Button1_Click(sender As System.Object, e As System.EventArgs) Handles Button1.Click
Try
Dim connectionString As String = "Provider=Microsoft.ACE.OLEDB.12.0 ;" & "Data Source= C:\TEST.accdb"
Dim dbConnection As System.Data.IDbConnection = New System.Data.OleDb.OleDbConnection(connectionString)
Dim myUpdateQuery As String = "Update Navire_Clients set equipage = 'Skipper' where Num = 10"
Dim myConnection As New OleDb.OleDbConnection(connectionString)
Dim myCommand As New OleDb.OleDbCommand(myUpdateQuery)
myCommand.Connection = myConnection
myConnection.Open()
myCommand.ExecuteNonQuery()
myConnection.Close()
Catch ex As Exception
MsgBox(ex.Message.ToString)
End Try
End Sub
End Class