积极答复者
关于“函数”的问题

问题
答案
-
您好,
请尝试下面的代码,希望对你有所帮助。如有什么疑问,请及时回复。
Public Class Form1
Dim A1(5) As String
Dim B1(5) As String
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
A1(0) = "C1"
A1(1) = "C2"
B1(0) = "D1"
B1(1) = "D2"
End Sub
Private Sub Button5_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button5.Click
Fun_Del(A1, 1)
MessageBox.Show(A1(1).ToString)
End Sub
Public Sub Fun_Del(ByVal arr As String(), ByVal i As Integer)
arr(i) = ""
End Sub
End Class
Best regards
Liliane Teng [MSFT]
MSDN Community Support | Feedback to us
Get or Request Code Sample from Microsoft
Please remember to mark the replies as answers if they help and unmark them if they provide no help.
- 已标记为答案 酷.睿 2011年1月28日 3:09
全部回复
-
-
您好,
不太理解你的意思。 假设如果已知i=1,你不知要删除A1(1)的值还是B1(1)的值?那知道要删除的数据是什么吗?可以把你的问题描述的更详细一点吗?
Best regards
Liliane Teng [MSFT]
MSDN Community Support | Feedback to us
Get or Request Code Sample from Microsoft
Please remember to mark the replies as answers if they help and unmark them if they provide no help.
-
对不起我没有说清楚~
“i”是不确定的,要删除的数组的名字都是不确定
比如FunctionDelete(<数组名>,<下标>)
这个函数就会删除这个数组的第指定个的数据。
谢谢~
if <数组名>="A1" then 你的删除操作
http://feiyun0112.cnblogs.com/ -
您好,
请尝试下面的代码,希望对你有所帮助。如有什么疑问,请及时回复。
Public Class Form1
Dim A1(5) As String
Dim B1(5) As String
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
A1(0) = "C1"
A1(1) = "C2"
B1(0) = "D1"
B1(1) = "D2"
End Sub
Private Sub Button5_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button5.Click
Fun_Del(A1, 1)
MessageBox.Show(A1(1).ToString)
End Sub
Public Sub Fun_Del(ByVal arr As String(), ByVal i As Integer)
arr(i) = ""
End Sub
End Class
Best regards
Liliane Teng [MSFT]
MSDN Community Support | Feedback to us
Get or Request Code Sample from Microsoft
Please remember to mark the replies as answers if they help and unmark them if they provide no help.
- 已标记为答案 酷.睿 2011年1月28日 3:09