Asked by mustish1
at 2024-07-10 21:16:13
Point:500 Replies:18 POST_ID:828952USER_ID:11851
Topic:
Microsoft Visual Basic.Net;;
Hi guys: Can any one please help me in that syntax error?
Thanks
Thanks
Attachment:SyntaxError.pngTable.png
Author: mustish1 replied at 2024-07-11 06:14:17
No errors but it not saving data in that column
Private Sub Button3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button3.Click
Dim selection As String = ""
If RadioButton1.Checked Then
selection = "A"
ElseIf RadioButton2.Checked Then
selection = "B"
ElseIf RadioButton3.Checked Then
selection = "C"
ElseIf RadioButton4.Checked Then
selection = "D"
End If
If (TABLE.Columns.Contains("UserAnswer") = False) Then
TABLE.Columns.Add(New DataColumn("UserAnswer", System.Type.GetType("System.String")))
End If
TABLE.Rows(CurrentRowIndex)("UserAnswer") = selection
TABLE.AcceptChanges()
End Sub
End Class
Private Sub Button3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button3.Click
Dim selection As String = ""
If RadioButton1.Checked Then
selection = "A"
ElseIf RadioButton2.Checked Then
selection = "B"
ElseIf RadioButton3.Checked Then
selection = "C"
ElseIf RadioButton4.Checked Then
selection = "D"
End If
If (TABLE.Columns.Contains("UserAnswer") = False) Then
TABLE.Columns.Add(New DataColumn("UserAnswer", System.Type.GetType("System.String")))
End If
TABLE.Rows(CurrentRowIndex)("UserAnswer") = selection
TABLE.AcceptChanges()
End Sub
End Class
Author: mustish1 replied at 2024-07-11 06:10:17
Program Code.
Assisted Solution
Expert: LordWabbit replied at 2024-07-11 05:51:10
71 points EXCELLENT
Then
should work fine, I am assuming you want to save this to a data store of some kind? If so how are you fetching your data, because acceptchanges will only worked with strongly typed data tables.
Author: mustish1 replied at 2024-07-11 05:46:03
Program screen shot without saving user selection.
Author: mustish1 replied at 2024-07-11 05:35:51
Syntax Error
Author: mustish1 replied at 2024-07-11 05:31:55
Yes I am using win forms in vb 2010
Author: mustish1 replied at 2024-07-11 05:30:58
Just want to save user selection in this column.
Thanks
Thanks
Expert: LordWabbit replied at 2024-07-11 05:26:15
ActiveDocument is used in word / excel / vs plugins etc. However it looks like you are working in a win forms application, which does not have ActiveDocument.
Assisted Solution
Expert: duncanb7 replied at 2024-07-11 05:21:05
71 points EXCELLENT
if You want put "selection" text in the Cell at UserAnswer
Please try this
ThisApplication.ActiveDocument.Tables(1).Cell(Row:=CurrentRowIndex, Column:=UserAnswer).Range.text="selection"
Could you explain more what you want for the cell at UserAnswer, Select it or putting "Selection" text into it?
Duncan
Please try this
ThisApplication.ActiveDocument.Tables(1).Cell(Row:=CurrentRowIndex, Column:=UserAnswer).Range.text="selection"
Could you explain more what you want for the cell at UserAnswer, Select it or putting "Selection" text into it?
Duncan
Author: mustish1 replied at 2024-07-11 05:03:22
Syntax Error
Assisted Solution
Expert: LordWabbit replied at 2024-07-11 03:56:40
72 points EXCELLENT
Basically the column does not exist in the table.
You could always add it.
You could always add it.
Expert: ste5an replied at 2024-07-11 00:06:07
Well, does your application work with the correct database? Do you retrieve the rows using a SELECT statement? Does it uses a fixed column list?
Assisted Solution
Expert: duncanb7 replied at 2024-07-10 21:57:52
72 points EXCELLENT
ActiveDocument.Tables(1).Cell(Row:=CurrentRowIndex, Column:=UserAnswer).Range.Select
Could you test this ?
Duncan
Could you test this ?
Duncan