vb.net源码实例的简单介绍

求一个VB.NET进行局域网内UDP广播的源代码例子给你个udp多播例子,广播不是很清楚,呵呵
Imports System.Net
Imports System.Net.Sockets
Imports System.Text
Public Class Form1
Inherits System.Windows.Forms.Form
Dim port As String
Dim ipadd As String
Dim ipend As IPEndPoint
Dim sendudp As New UdpClient()
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) _
Handles Button1.Click
Dim ipadress As IPAddress
ipadress = IPAddress.Parse(TextBox1.Text)
'sendport = Int32.Parse(TextBox2.Text)
'ipend = New IPEndPoint(ipadress, sendport)
Try
sendudp.JoinMulticastGroup(ipadress)
MessageBox.Show("启动完成!")
Catch ex As Exception
MessageBox.Show(ex.Message)
End Try
End Sub
用VB.NET程序编写代码Delphi代码如下:
procedure TForm1.Button1Click(Sender: TObject);
var
购物总价:Integer;
折扣:Extended;
begin
购物总价:=StrToInt(Edit1.Text);
if 购物总价250 then
begin
折扣:=0;
end
else if 购物总价500 then
begin
折扣:=0.05;
end
else if 购物总价1000 then
begin
折扣:=0.075;
end
else if 购物总价2000 then
begin
折扣:=0.1;
end
{
此段的折扣是多少?
else if 购物总价3000 then
begin
折扣:=0.05;
end
}
else if 购物总价=3000 then
begin
折扣:=0.15;
end;
ShowMessage('您享受的折扣是:'+FloatToStr(折扣)
+' 原价:'+IntToStr(购物总价)
+' 折后总价:'+FloatToStr(购物总价*(1-折扣)));
end;
求vb.net的源代码 , 最好说明其解决问题,越多越好,满意加50分 。下面这段代码vb.net源码实例,是我用来计算每个月存500元进银行vb.net源码实例 , 连续30年 , 最后连本带利能有多少钱 。这里面涉及复利计算 。界面中右边的文本框用来输出每一次计算的结果 。
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Dim nianxian As Integer '年限变量
Dim dingcun As Integer '定存变量
Dim fuli_big As Long '大复利
Dim fuli_small As Long '小复利
Dim i As Integer '循环变量
Dim DATAstring As String '数据字符串
nianxian = Val(年限_TextBox.Text)
dingcun = Val(定存_TextBox.Text)
DATAstring = ""
For i = 1 To nianxian
fuli_small = dingcun * (1 + 0.1875)
dingcun = fuli_small
fuli_big = fuli_big + fuli_small
DATAstring = DATAstring + "[" + Trim(Str(i)) + "]" + Str(fuli_big) + Chr(13) + Chr(10)
'DATAstring = DATAstring + "[" + Trim(Str(i)) + "]" + Str(fuli_small) + Chr(13) + Chr(10)
Next
'fuli_big = fuli_small
TextBox1.Text = DATAstring
结果_TextBox.Text = Str(fuli_big) + "元"
End Sub
求用vbnet 实现先进先出即队列得源代码VB.Net中的队列类在System.Collections.Generic命名空间中,名字叫Queue , 是一个泛型类 。
实例化该类:
Dim myQueue As QueueInt32
myQueue = new QueueInt32();
然后可以通过Queue中的Enqueue和Dequeue函数进行入队出队操作:
With myQueue
.Enqueue(1)
.Enqueue(2)
.Enqueue(3)
.Enqueue(4)
.Enqueue(5)
End With
For i = 0 To 5 Step 1
Console.WriteLine(myQueue.Dequeue())
Next i
显示结果:
1
2
3
4
5
求VB.NET网站权限的源代码或实例GRANT { { SELECT | INSERT | UPDATE | DELETE | REFERENCES | TRIGGER }
[,...] | ALL [ PRIVILEGES ] }
ON [ TABLE ] tablename [, ...]
TO { username | GROUP groupname | PUBLIC } [, ...] [ WITH GRANT OPTION ]

推荐阅读