标题:[求助]用VB.NET编写程序
只看楼主
wangshuang19
Rank: 1
等 级:新手上路
帖 子:4
专家分:0
注 册:2006-12-17
 问题点数:0 回复次数:2 
[求助]用VB.NET编写程序
4.要求用户5位同学的信息:姓名,年龄,发‘通信地址,邮政编码,电话,然后将数据用适当的格式显示出来
搜索更多相关主题的帖子: NET 编写 
2006-12-17 22:06
冰河世纪
Rank: 3Rank: 3
等 级:新手上路
威 望:6
帖 子:2167
专家分:0
注 册:2006-11-7
得分:0 

Dim a(4, 4) As Object
Dim i, j As Integer

Private Sub Form1_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
For i = 0 To 4
For j = 0 To 4
If j = 0 Then
a(i, j) = "姓名:" & InputBox("请输入姓名", "还有" & 5 - i & "个")
ElseIf j = 1 Then
a(i, j) = "年龄:" & InputBox("请输入年龄", "还有" & 5 - i & "个")
ElseIf j = 2 Then
a(i, j) = "通信地址:" & InputBox("请输入通信地址", "还有" & 5 - i & "个")
ElseIf j = 3 Then
a(i, j) = "邮政编码:" & InputBox("请输入邮政编码", "还有" & 5 - i & "个")
ElseIf j = 4 Then
a(i, j) = "电话:" & InputBox("请输入电话", "还有" & 5 - i & "个")
End If
Next
Next
End Sub

Private Sub Button1_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles Button1.Click
Dim mystr As String = ""
For i = 0 To 4
For j = 0 To 4
mystr = mystr & a(i, j) & Space(3)
Next
mystr = mystr & vbCrLf
Next
MsgBox(mystr, , "个人资料")
End Sub


冰一样的少年,外表是冰,冷酷而强大;内心是冰,却一暖成水,柔柔漫漫
2006-12-22 16:40
szmq2
Rank: 1
等 级:新手上路
帖 子:82
专家分:0
注 册:2006-12-25
得分:0 

个人觉得用一维数组+结构比较好


2006-12-25 11:34



参与讨论请移步原网站贴子:https://bbs.bccn.net/thread-110175-1-1.html




关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.233143 second(s), 7 queries.
Copyright©2004-2024, BCCN.NET, All Rights Reserved