vb2010 - 来自MS Access记录的TextBox1.Text

时间:2022-06-23 00:58:25

I am new to vb2010 and have been successful with google searches for all my previous problems but this one i cannot make any traction on so I am looking for a little help on the correct syntax.

我是vb2010的新用户并且已经成功通过谷歌搜索我之前的所有问题,但是这个我无法提供任何牵引力所以我正在寻找一些关于正确语法的帮助。

Public Class Form2


    Private Sub Form2_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
        'TODO: This line of code loads data into the 'IRuleDataSet.Stnds' table. You can move, or remove it, as needed.
        Me.StndsTableAdapter.Fill(Me.IRuleDataSet.Stnds)


        'Populates listbox1 with data from iRuleDataSet table
        ListBox1.DataSource = IRuleDataSet.Stnds
        ListBox1.DisplayMember = "Standards"
        ListBox1.SelectedIndex = 0

    End Sub


    Private Sub StndsBindingNavigatorSaveItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs)
        Me.Validate()
        Me.StndsBindingSource.EndEdit()
        Me.TableAdapterManager.UpdateAll(Me.IRuleDataSet)

    End Sub

    Private Sub ExitToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ExitToolStripMenuItem.Click
        End
    End Sub

    Private Sub ListBox1_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ListBox1.SelectedIndexChanged
        Label2.Text = ListBox1.Text & " IRule"
'~~>This is where I am stuck
'~~>    TextBox1.Text = IRuleDataSets.Stnds.IRule.ListBox1.SelectedIndex bah i can't get this ):
    End Sub
End Class

in form 2, I have loaded an access database into a DataSet labeld IRuleDataSet.Stnds

在表单2中,我已将访问数据库加载到标记为IRuleDataSet.Stnds的DataSet中

Table = Stnds

表=趋势

Field = IRule

Field = IRule

Record Position = ListBox1.SelectedIndex

记录位置= ListBox1.SelectedIndex

what would be the correct syntax or naming convention/logic to have the corresponding text for the record position in Field: "IRule" that the user selects in ListBox1 to display in TextBox1?

在Field中的记录位置具有相应文本的正确语法或命名约定/逻辑是什么:用户在ListBox1中选择要在TextBox1中显示的“IRule”?

This isn't for any schooling subject or anything like that. This is merely a learning exercise for myself to put together a GUI for calculations that are currently done in an overly complicated xls file at my work, so any help would be appreciated. I don't know if it is becoming too late for me or not but I just cannot seem to find the correct way to approach this seemingly simple task.

这不适用于任何教育科目或类似的东西。对于我来说,这仅仅是一个学习练习,可以将我目前在我工作中过于复杂的xls文件中进行计算的GUI组合在一起,所以任何帮助都会受到赞赏。我不知道这对我来说是否已经太晚了,但我似乎无法找到正确的方法来处理这个看似简单的任务。

Thank you

1 个解决方案

#1


0  

AHA!

sure enough as soon as i post a question i find the correct solution

当我发布问题时,我发现正确的解决方案

TextBox1.Text = IRuleDataSet.Stnds(ListBox1.SelectedIndex)(2).ToString

what this does, it sets TextBox1 text to look in to the imported access file (as IRuleDataSet.Stnds) then looks at the 'row' (ListBox1.SelectedIndex), and then the column number (2). i know this is 2 because when i put in my dummy data in the database, the field of interest was the second column.

这样做,它设置TextBox1文本以查找导入的访问文件(作为IRuleDataSet.Stnds),然后查看'row'(ListBox1.SelectedIndex),然后查看列号(2)。我知道这是2,因为当我在数据库中输入我的虚拟数据时,感兴趣的领域是第二列。

i hope this helps future googlers (:

我希望这有助于未来的googlers(:

#1


0  

AHA!

sure enough as soon as i post a question i find the correct solution

当我发布问题时,我发现正确的解决方案

TextBox1.Text = IRuleDataSet.Stnds(ListBox1.SelectedIndex)(2).ToString

what this does, it sets TextBox1 text to look in to the imported access file (as IRuleDataSet.Stnds) then looks at the 'row' (ListBox1.SelectedIndex), and then the column number (2). i know this is 2 because when i put in my dummy data in the database, the field of interest was the second column.

这样做,它设置TextBox1文本以查找导入的访问文件(作为IRuleDataSet.Stnds),然后查看'row'(ListBox1.SelectedIndex),然后查看列号(2)。我知道这是2,因为当我在数据库中输入我的虚拟数据时,感兴趣的领域是第二列。

i hope this helps future googlers (:

我希望这有助于未来的googlers(: