窗体上添加3个标签,1个按钮,在按钮的单击事件里写代码,如下:
成都创新互联公司专业为企业提供湖州网站建设、湖州做网站、湖州网站设计、湖州网站制作等企业网站建设、网页设计与制作、湖州企业网站模板建站服务,10余年湖州做网站经验,不只是建网站,更提供有价值的思路和整体网络服务。
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Dim a(,) As Integer = {{5, 6}, {1, 3}, {8, 9}, {72, 1}, {63, 4}}
Dim Temp As Integer
Dim i As Integer
Dim j As Integer
Dim x As Integer
Dim y As Integer
'显示排序前的数据
Label1.Text = "排序前数据:" vbCrLf
For i = 0 To 4
Label1.Text = Label1.Text a(i, 0) " " a(i, 1) vbCrLf
Next
For i = 0 To 3
For j = i + 1 To 4
If a(i, 0) a(j, 0) Then
Temp = a(i, 0)
a(i, 0) = a(j, 0)
a(j, 0) = Temp
Temp = a(i, 1)
a(i, 1) = a(j, 1)
a(j, 1) = Temp
End If
Next
Next
'显示排序前的数据
Label2.Text = "排序后数据:" vbCrLf
For i = 0 To 4
Label2.Text = Label2.Text a(i, 0) " " a(i, 1) vbCrLf
Next
'把第3行元素赋予X,Y
x = a(2, 0)
y = a(2, 1)
'输出X,Y
Label3.Text = "X=" x vbCrLf "Y=" y
End Sub
数组好像没有快速赋值吧,或者你再把问题再清楚一点。
语句执行时间倒是可以做到。在语句前
Dim oldTime As Date = Now
在过程语句后加
Dim newTime As Date = Now
Dim differenceInSeconds As Long = DateDiff(DateInterval.Second, oldTime, newTime)
textbox1.text= "共用了:" differenceInSeconds "秒!"
vb.net已经去掉了控件数组这个类,不过有个代替该方式的一个属性:Tag,你可以把这些关联的Tag属性设置为同一标记,如:a。然后遍历所有的checkbox并且tag为a的则选定:Protected Sub chkAll_Click() For Each ctl As Control In Me.Controls ''如果checkbox在一个容器里,比如groupbox,那可以用groupbox.controls
If ctl.GetType().Name.ToLower() = "checkbox" Then
CType(ctl, CheckBox).Checked = CheckBox3.Checked
End If
NextEnd Sub
for i = 0 to 3
textbox_未知.text = a(i,1) a(i,2) a(i,3) a(i,4) vbcrlf
next
如果我吧长宽弄反了自行转正,
如果要间隔,请插入 VBtab
参考
#includestdio.h
int main()
{int n,i,j,t,a[200];
printf("数组中数的个数:");
scanf("%d",n);
printf("数组中的数:\n");
for(i=0;in;i++)
{
a[i]=i+1;
printf("%d ",a[i]);
}
for(i=0,j=n-1;ij;i++,j--)
{t=a[i];a[i]=a[j];a[j]=t;}
printf("\n逆序后的数组:\n");
for(i=0;in;i++)
printf("%d ",a[i]);
printf("\n");
getch();
return 0;
}
售后响应及时
7×24小时客服热线数据备份
更安全、更高效、更稳定价格公道精准
项目经理精准报价不弄虚作假合作无风险
重合同讲信誉,无效全额退款