包含vb.net编程实例的词条

VB.net实例1 生成txt文件 。
DimSaveFileDialog1AsNewSaveFileDialog() '创建一个保存对话框
SaveFileDialog1.Filter ="txt files (*.txt)|*.txt" '设置扩展名
IfSaveFileDialog1.ShowDialog() = System.Windows.Forms.DialogResult.OKThen '如果确定保存
My.Computer.FileSystem.WriteAllText(SaveFileDialog1.Filename, Textbox1.Text,False) '保存文本,False表示不追加文本,直接覆盖其内容
EndIf
原文链接:
关于vb.net中socket编程实例:服务器端的一些问题Socket类连接后 可以通过类中的 RemoteEndPoint 来获取远程IP和端口信息.
要注意的是.需要将它强制转化为 IPEndPoint类型 然后通过 IPEndPoint.Address以及IPEndPoint.Port来获取对应的IP及端口
例:
Dim REV_SCK As New Socket(AddressFamily.InterNetwork, SocketType.Dgram, ProtocolType.Udp)
'这里创建一个UDP Socket连接的实例 TCP也是一样的
'省略SOCKET连接的代码 当SOCKET连接成功后 可以用下面的语句获取远程信息
Dim IP as string ,Port as integer
'定义IP和Port变量 用来保存地址及端口
IP = IPAddress.Parse(CType(REV_SCK.RemoteEndPoint, IPEndPoint).Address.ToString())
Port = IPAddress.Parse(CType(REV_SCK.RemoteEndPoint, IPEndPoint).Port)
VB.NET 拖动无边框窗体编程实例 Imports System Drawing Imports System Windows Forms****************************************** Private oOriginalRegion As Region = Nothing用于窗体移动 Private bFormDragging As Boolean = False Private oPointClicked As Point****************************************** Private Sub Form _MouseDown(ByVal sender As Object ByVal e As System Windows Forms MouseEventArgs) Handles MyBase MouseDown Me bFormDragging = True Me oPointClicked = New Point(e X e Y) End Sub****************************************** Private Sub Form _MouseUp(ByVal sender As Object ByVal e As System Windows Forms MouseEventArgs) Handles MyBase MouseUp Me bFormDragging = False End Sub****************************************** Private Sub Form _MouseMove(ByVal sender As Object ByVal e As System Windows Forms MouseEventArgs) Handles MyBase MouseMove If Me bFormDragging Then Dim oMoveToPoint As Point以当前鼠标位置为基础 找出目标位置 oMoveToPoint = Me PointToScreen(New Point(e X e Y))根据开始位置作出调整 oMoveToPoint Offset(Me oPointClicked X * _ (Me oPointClicked Y_ SystemInformation CaptionHeight_ SystemInformation BorderSize Height) * )移动窗体 Me Location = oMoveToPoint End If
【包含vb.net编程实例的词条】lishixinzhi/Article/program/ASP/201311/21755
vb.net编程实例的介绍就聊到这里吧 , 感谢你花时间阅读本站内容,更多关于、vb.net编程实例的信息别忘了在本站进行查找喔 。

    推荐阅读