Visual Basic在数组中输入信息 [英] Visual Basic enter information in an array

查看:121
本文介绍了Visual Basic在数组中输入信息的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有两个文本框,用于输入学生的姓名和分数.

I have two text boxes to enter the Name and the Marks of students.

我不知道如何在Visual Basic中为其创建数组

I don't know how to create the array for it in Visual Basic

该数组必须是多维的,并且还需要具有一个索引,该索引在每次输入新的标记和名称时都会递增.

The array must be multidimensional and also needs to have an index that increments every time a new mark and name is entered.

数组完成后,我需要将结果显示在列表框中.

Once the array is completed I need the results to show in a list box.

谢谢

编辑!!!

这是我现在拥有的代码,但我仍然有一些错误

This is the code i now have but i still have few errors

Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click

    Dim LName As New List(Of String)
    Dim LMark As New List(Of Integer)


    LName.Add(txtEnterName.Text)
    LMark.Add(txtEnterMarks.Text)

    For counterOne As Integer = 0 To 10

        For counterTwo As Integer = 0 To 10

       Array[counterOne][counterTwo] = listview.text

        Next

    Next
End Sub

推荐答案

基本上像这样..

Dim LName as New List(Of String)
Dim LMark as New List(Of Integer)

因此,如果要将文本框添加到..

So, if you want to add your textbox into ..

LName.Add(Textbox1.Text)
LMark.Add(TextBox2.Text)

下一步,您必须了解List Of ..我确定Google先生会为您提供帮助..

For Next you have to learn about List Of .. I'm sure Mr. Google will help you ..

要产生ListBox ..更好,请使用带有两列的ViewListBox ..

To resulting in ListBox .. better you use ViewListBox with 2 columns ..

这篇关于Visual Basic在数组中输入信息的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆