雪糕先生 发布于 2011/06/04 11:26
判断当前网络是否连接正常可以引用My.Computer.Network的IsAvailable属性,方法如下:
雪糕先生 发布于 2011/01/11 20:48
下面以动态加入一个Button按钮为例,在窗体加入一个名为Button1的按钮,下面是源代码:
Public Class Form1
'动态加入控件实例 晨彦电脑科技 WWW.BTOSS.COM
Private Sub newbutton_click(ByVal sender As System.Object, ByVal e As System.EventArgs)
MsgBox("动态加入控件实例 晨彦电脑科技 WWW.BTOSS.COM")
End Sub
Private Sub Button1_Click_1(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Dim newbutton As New Button
newbutton.Text = "newbutton"
AddHandler newbutton.Click, AddressOf newbutton_click
Me.Controls.Add(newbutton)
End Sub
End Class
引用
Public Class Form1
'动态加入控件实例 晨彦电脑科技 WWW.BTOSS.COM
Private Sub newbutton_click(ByVal sender As System.Object, ByVal e As System.EventArgs)
MsgBox("动态加入控件实例 晨彦电脑科技 WWW.BTOSS.COM")
End Sub
Private Sub Button1_Click_1(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Dim newbutton As New Button
newbutton.Text = "newbutton"
AddHandler newbutton.Click, AddressOf newbutton_click
Me.Controls.Add(newbutton)
End Sub
End Class
雪糕先生 发布于 2011/01/02 21:42
VB.NET删除文本框TextBox1.Text 中空行的方法:
'删除文本框中空行的方法 晨彦电脑科技 www.btoss.com
Dim Row1, Row2 As Integer
Dim line() As String
Dim ArList As New ArrayList
If Me.TextBox1.Text <> "" Then'当文本框为空时
Row1 = Me.TextBox1.Lines.Length - 1
For i = 0 To Row1
If Me.TextBox1.Lines(i).ToString <> "" Then'当行不为空时
ArList.Add(Trim(Me.TextBox1.Lines(i).ToString))
End If
Next
Row2 = ArList.Count - 1
ReDim line(Row2)
For i = 0 To Row2
line(i) = ArList.Item(i).ToString
Next
Me.TextBox1.Lines = line
End If
引用
'删除文本框中空行的方法 晨彦电脑科技 www.btoss.com
Dim Row1, Row2 As Integer
Dim line() As String
Dim ArList As New ArrayList
If Me.TextBox1.Text <> "" Then'当文本框为空时
Row1 = Me.TextBox1.Lines.Length - 1
For i = 0 To Row1
If Me.TextBox1.Lines(i).ToString <> "" Then'当行不为空时
ArList.Add(Trim(Me.TextBox1.Lines(i).ToString))
End If
Next
Row2 = ArList.Count - 1
ReDim line(Row2)
For i = 0 To Row2
line(i) = ArList.Item(i).ToString
Next
Me.TextBox1.Lines = line
End If
雪糕先生 发布于 2011/01/01 19:36
下面是VB.NET 修改桌面壁纸的方法:
引用
Public Class Form1
'晨彦电脑科技 www.btoss.com
Private Const SPI_SETDESKWALLPAPER As Integer = &H14
Private Const SPIF_UPDATEINIFILE As Integer = &H1
Private Const SPIF_SENDWININICHANGE As Integer = &H2
Private Declare Auto Function SystemParametersInfo Lib "user32.dll" ( _
ByVal uAction As Integer, ByVal uParam As Integer, _
ByVal lpvParam As String, ByVal fuWinIni As Integer) As Integer
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
SystemParametersInfo(SPI_SETDESKWALLPAPER, 0, "图片地址", 1)
End Sub
End Class
'晨彦电脑科技 www.btoss.com
Private Const SPI_SETDESKWALLPAPER As Integer = &H14
Private Const SPIF_UPDATEINIFILE As Integer = &H1
Private Const SPIF_SENDWININICHANGE As Integer = &H2
Private Declare Auto Function SystemParametersInfo Lib "user32.dll" ( _
ByVal uAction As Integer, ByVal uParam As Integer, _
ByVal lpvParam As String, ByVal fuWinIni As Integer) As Integer
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
SystemParametersInfo(SPI_SETDESKWALLPAPER, 0, "图片地址", 1)
End Sub
End Class
雪糕先生 发布于 2010/12/27 13:07
下面是列出当前文件夹中所有JPG图片文件名的方法:
Dim str As String
For Each file In My.Computer.FileSystem.GetFiles(Application.StartupPath)
If System.IO.Path.GetExtension(file) = ".jpg" Then
str = System.IO.Path.GetFileNameWithoutExtension(file)
ListBox1.Items.Add(Application.StartupPath & str & ".jpg")
End If
Next
For Each file In My.Computer.FileSystem.GetFiles(Application.StartupPath)
If System.IO.Path.GetExtension(file) = ".jpg" Then
str = System.IO.Path.GetFileNameWithoutExtension(file)
ListBox1.Items.Add(Application.StartupPath & str & ".jpg")
End If
Next
雪糕先生 发布于 2010/12/26 20:35
写程序的时候,有时需要获取一些系统的信息资料,下面列出方法:
获取此本地计算机的名称:
获取操作系统版本:
获取此本地计算机的名称:
MsgBox (Environment.MachineName)
获取操作系统版本:
MsgBox(Val(Environment.OSVersion.Version.ToString))
雪糕先生 发布于 2010/12/16 13:24
下面是创建代码:
If File.Exists("C:\abc.txt") Then
File.Delete("C:\abc.txt")
End If
Dim sr As StreamWriter = File.CreateText("C:\abc.txt")
sr.Write("晨彦电脑科技")
sr.WriteLine("WWW.BTOSS.COM")
sr.Write("这是一个创建文本文件的例子")
sr.Close()
下面是读取代码:
引用
If File.Exists("C:\abc.txt") Then
File.Delete("C:\abc.txt")
End If
Dim sr As StreamWriter = File.CreateText("C:\abc.txt")
sr.Write("晨彦电脑科技")
sr.WriteLine("WWW.BTOSS.COM")
sr.Write("这是一个创建文本文件的例子")
sr.Close()
下面是读取代码:
雪糕先生 发布于 2009/11/28 17:10
加入Microsoft Internet Controls控件,在窗体中加入一个Webbrowser,两个TextBox文本框,一个CommandButton按钮,下面是代码:
分类
热门文章
- [45702]五种方法安装Windows...
- [29082]您可能需要与该网络的 in...
- [14243]开机自动检测网络状态运行程...
- [14124]2012东埔英歌舞
- [12581]APMServ一键快速搭建...
- [12550]双路由器上网的连接和设置方...
- [12482]Google提供的免费天气...
- [12412]各种BIOS的设置细解
- [12390]EvaPhone - 无需...
- [12124]雪糕乐园小游戏集2.04版...