Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/vb.net/16.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Vb.net 从datagrid获取数据集中用作增量的值_Vb.net - Fatal编程技术网

Vb.net 从datagrid获取数据集中用作增量的值

Vb.net 从datagrid获取数据集中用作增量的值,vb.net,Vb.net,基本上,我需要从datagrid中获取一个值,这是一个文本,在引用数据集时用作增量。我的进步还有其他方面。在这里,我使用一个文本,它的工作 inc = DGHomework.Item("QuizID", DGHomework.CurrentRow.Index).ToString 'retriveing questions and asnwers from the database Q1 = datasetQuiz.Tables("quizdetails").Rows(in

基本上,我需要从datagrid中获取一个值,这是一个文本,在引用数据集时用作增量。我的进步还有其他方面。在这里,我使用一个文本,它的工作

 inc = DGHomework.Item("QuizID", DGHomework.CurrentRow.Index).ToString


    'retriveing questions and asnwers from the database

    Q1 = datasetQuiz.Tables("quizdetails").Rows(inc).Item(7)
    A1 = datasetQuiz.Tables("quizdetails").Rows(inc).Item(8)
    Q2 = datasetQuiz.Tables("quizdetails").Rows(inc).Item(9)
这意味着这个值不能转换成整数,因为我有inc=

inc = DGHomework.Item("QuizID", DGHomework.CurrentRow.Index).ToString
这是你的问题。看看inc是在哪里声明的。要么将is声明为整数,要么将另一个变量声明为整数。。如下..如果您需要inc作为其他字符串

inc = DGHomework.Item("QuizID", DGHomework.CurrentRow.Index).ToString


'retriveing questions and asnwers from the database
dim index as integer=DGHomework.Item("QuizID", DGHomework.CurrentRow.Index)
Q1 = datasetQuiz.Tables("quizdetails").Rows(index).Item(7)
A1 = datasetQuiz.Tables("quizdetails").Rows(index).Item(8)
Q2 = datasetQuiz.Tables("quizdetails").Rows(index).Item(9)
或者你可以使用

inc = DGHomework.Item("QuizID", DGHomework.CurrentRow.Index).ToString


'retriveing questions and asnwers from the database

Q1 = datasetQuiz.Tables("quizdetails").Rows(val(inc)).Item(7)
A1 = datasetQuiz.Tables("quizdetails").Rows(val(inc)).Item(8)
Q2 = datasetQuiz.Tables("quizdetails").Rows(val(inc)).Item(9)

那么它的价值是什么,它肯定不是一个数字。。。另外,如果变量是整数,则不能执行
ToString
。可能是你的问题。删除该选项并将其设置为严格选项也可以进行其他更改,但不是本例中的罪魁祸首…我如何将选项设置为严格选项以及它的作用是什么?在类的顶部或项目级别声明它。。。如果你想知道。。。