Ask Question Forum:
Model Library:2025-02-08:A.I. model is online auto reply
C
O
M
P
U
T
E
R
2
8
Show
#
ASK
RECENT
←
- Underline
- Bold
- Italic
- Indent
- Step
- Bullet
- Quote
- Cut
- Copy
- Paste
- Table
- Spelling
- Find & Replace
- Undo
- Redo
- Link
- Attach
- Clear
- Code
Below area will not be traslated by Google,you can input code or other languages
Hint:If find spelling error, You need to correct it,1 by 1 or ignore it (code area won't be checked).
X-position of the mouse cursor
Y-position of the mouse cursor
Y-position of the mouse cursor
Testcursor
caretPos
Attachment:===
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
Accepted Solution
Expert: LordWabbit replied at 2024-07-11 06:41:56
72 points EXCELLENT
You did not save the table. You will also need the ID if you want to save the answer to the database.
Author: mustish1 replied at 2024-07-11 06:29:50
I did
Assisted Solution
Expert: LordWabbit replied at 2024-07-11 06:26:48
71 points EXCELLENT
You need to add the UserAnswer column to the table in your access database
Author: mustish1 replied at 2024-07-11 06:19:01
Syntax Error in LoadListView()
Assisted Solution
Expert: ste5an replied at 2024-07-11 06:14:50
71 points EXCELLENT
Dim sqlQuery As String = "Select Question, AnswerA, AnswerB, AnswerC, AnswerD, CorrectAnswer from tblGame" 1:
E.g.
Sub LoadListView() Dim sqlQuery As String = "Select Question, AnswerA, AnswerB, AnswerC, AnswerD, CorrectAnswer, UserAnswer from tblGame" Dim sqlCommand As New OleDbCommand Dim sqlAdapter As New OleDbDataAdapter With sqlCommand .CommandText = sqlQuery .Connection = conn End With With sqlAdapter .SelectCommand = sqlCommand .Fill(TABLE) End With RichTextBox1.Text = TABLE(0)("Question") RichTextBox2.Text = TABLE(1)("AnswerA") RichTextBox3.Text = TABLE(2)("AnswerB") RichTextBox4.Text = TABLE(3)("AnswerC") RichTextBox5.Text = TABLE(4)("AnswerD") ShowRecord() End Sub 1:2:3:4:5:6:7:8:9:10:11:12:13:14:15:16:17:18:19:
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.
If (TABLE.Columns.Contains("UserAnswer") = False) Then TABLE.Columns.Add(New DataColumn("UserAnswer", System.Type.GetType("System.String"))) End If 1:2:3:
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