I notice you didn't have @farmer when adding value, the query wasn't complete. Try add @farmer value and see what's going to happen.
Begginnerdev commented: Trying to force them to think :) +8
I notice you didn't have @farmer when adding value, the query wasn't complete. Try add @farmer value and see what's going to happen.
You're not conneting with the database, or your query is wrong, or value is NULL, etc.
Say, why did you give out a no-information question? Please show more information, sample code, or image, or description so we could provide better helps.
@ddanbe: Then I was wrong, sorry then, I did think that GeekPlease wants to return value from col "Id" in his table (which was different from the col index).
@GeekPlease: Changed my code, super fast and easy now:
Private Sub DataGridView1_CellValueChanged(ByVal sender As Object, ByVal e As System.Windows.Forms.DataGridViewCellEventArgs) Handles DataGridView1.CellValueChanged
MsgBox(DataGridView1.SelectedCells.Item(0).ColumnIndex)
End Sub
Hey Shan, bdev's trying to tell you to fill the Try-Catch with "What you want", for example:
Try
Dim a as String = ""
a = txtadd1.Name
MsgBox(a.ToString)
'... then do something you want here
Catch ex As Exception
MsgBox(ex.ToString)
End Try
I believe .FileName in Vb.Net is a name with a path, but that doesn't matter. If you couldn't use For Each then For Next, and if you have a .FileNam then remove the path. Here's your code then, since it finished, mark this question as solved if you found your answer:
Dim Path As String = "Your Path Here, with a "\" at the end"
Dim file() As String = Directory.GetFiles(Path.Trim, "*.txt")
For i As Integer = 0 To file.Length - 1
Dim SMSdtl As String
Dim txtReader As New System.IO.StreamReader(file(i))
Do While txtReader.Peek() <> -1
SMSdtl = txtReader.ReadToEnd.ToString.Trim
Loop
TextBox4.Text = SMSdtl.ToString.Trim
TextBox1.Text = file(i).Replace(Path.Trim, "").Trim
Next
Actually it's quite simple.
The f in the those code lines is itself a .Filename, so you only need to fill f to your TextBox3, SMS information into TextBox4. I'll give you some hints to make it easier, it'll work right away but might need some fixes to avoid marginal errors.
Dim f As String() = Directory.GetFiles("YourTextFilesPath", "*.txt")
For Each f In f()
Dim SMSdtl As String
Dim txtReader As New System.IO.StreamReader(f)
Do While txtReader.Peek() <> -1
SMSdtl = SMSdtl & txtReader.ReadLine() & vbNewLine
Loop
Textbox3.Text = f
Textbox4.Text = SMSdtl
Next
I'll help change your button2 then:
Dim f As String() = Directory.GetFiles("YourTextFilesPath", "*.txt")
For Each dir In dirs
...
'Do anything you want with f.FileName
...
Next
Here's your code:
Private Sub TextBox1_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles TextBox1.TextChanged
TextBox1.Text = TextBox1.Text.ToUpper()
End Sub
I suggest that your 'stateSlsTax' has not been set as Decimal, try this code instead:
Dim stateSlsTax As Decimal
stateSlsTax = Convert.ToDecimal(txbStateTaxPcnt.Text)
txbStateTaxPcnt.Text = stateSlsTax.ToString("n2")
If this one not working corectly, I think you should check if there are any '.Trim()' things around your code.
gusano79 solution is right for all objects. But I suspect you are tagging picturebox here, so how about using RotateFlip() to Flip the image inside the picturebox but not a whole picturebox itself?