vb2010.net源码,net vb
求vb.net(vb2010)程序代码 产生30个50以内的随机正整数,将他们从大到小排序后输出
vb2010写的:
创新互联是专业的赤壁网站建设公司,赤壁接单;提供成都网站制作、做网站、外贸营销网站建设,网页设计,网站设计,建网站,PHP网站建设等专业做网站服务;采用PHP框架,可快速的进行赤壁网站开发网页制作和功能扩展;专业做搜索引擎喜爱的网站,专业的做网站团队,希望更多企业前来合作!
Private Sub Button7_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button7.Click
Dim str As String = ""
Dim a(30) As Integer
Dim temp As Integer
str = str "生成的30个随机数字是 " vbCrLf
For i = 1 To 30
a(i) = Int(Rnd() * 50 + 1)
str = str a(i) " "
If i Mod 10 = 0 Then
str = str vbCrLf
End If
Next
str = str vbCrLf
For i = 1 To 30
For j = 1 To 30 - i
If a(j) a(j + 1) Then
temp = a(j + 1)
a(j + 1) = a(j)
a(j) = temp
End If
Next j
Next i
str = str "排序后的数字是 " vbCrLf
For i = 1 To 30
str = str a(i) " "
If i Mod 10 = 0 Then
str = str vbCrLf
End If
Next
TextBox6.Text = str
End Sub
运行结果:
生成的30个随机数字是
36 27 29 15 16 39 1 39 41 36
3 21 44 40 19 49 44 3 48 19
27 39 3 30 24 15 32 33 14 14
排序后的数字是
49 48 44 44 41 40 39 39 39 36
36 33 32 30 29 27 27 24 21 19
19 16 15 15 14 14 3 3 3 1
vb.net和vb2010的关系?
其实没有所谓的VB2010,应该是VS2010,其中集成了VB、C#等一系列开发语言,也就是在VS中,你可以选择其中一种语言来进行开发,这些语言都工作在.Net的框架中。所以,VS2010中包括了VB.Net。
VB2010.NET 将CheckBox1到CheckBox25所有未选中状态的所对应的数值中选取6个进行从小到大排列,并输出.
为插入的复选框控件CheckBox1添加下面的代码。
Private Sub CheckBox1_Click()
If CheckBox1.Value Then '如果勾选复选框就执行下一句
Sheets("Sheet1").Range("a1") = 0 'Sheet1工作的A1单元格为0
End If '如果取消勾选则不进行任何操作
End Sub
VB2010或VB.NET 怎么能将自身窗体的所有内容保存为图片
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
System.Windows.Forms.SendKeys.Send("%{PRTSC}")
Delay(0.1)
Dim bmp As Bitmap = CType(Clipboard.GetDataObject().GetData(DataFormats.Bitmap), Bitmap)
bmp.Save("c:\test1.jpg", System.Drawing.Imaging.ImageFormat.Jpeg)
End Sub
Private Sub Delay(ByVal tim As Single)
Dim t As Single = Microsoft.VisualBasic.Timer + tim
While t Microsoft.VisualBasic.Timer
My.Application.DoEvents()
End While
End Sub
VB2010版中怎么用用OLE控件连接CAD软件,显示CAD图形?会的给段代码
vb2010(vb.net)貌似已经没有OLE控件
下面的代码是用PictureBox控件显示CAD的DWG文件
Private Structure BITMAPFILEHEADER
Dim bfType As Short
Dim bfSize As Integer
Dim bfReserved1 As Short
Dim bfReserved2 As Short
Dim bfOffBits As Integer
End Structure
Public Function GetDwgImage(ByVal FileName As String) As Image
If Not File.Exists(FileName) Then Exit Function
Dim DwgF As FileStream '文件流
Dim PosSentinel As Integer '文件描述块的位置
Dim br As BinaryReader '读取二进制文件
Dim TypePreview As Integer '缩略图格式
Dim PosBMP As Integer '缩略图位置
Dim LenBMP As Integer '缩略图大小
Dim biBitCount As Short '缩略图比特深度
Dim biH As BITMAPFILEHEADER 'BMP文件头,DWG文件中不包含位图文件头,要自行加上去
Dim BMPInfo() As Byte '包含在DWG文件中的BMP文件体
Dim BMPF As New MemoryStream '保存位图的内存文件流
Dim bmpr As New BinaryWriter(BMPF) '写二进制文件类
Dim myImg As Image
Try
DwgF = New FileStream(FileName, FileMode.Open, FileAccess.Read) '文件流
br = New BinaryReader(DwgF)
DwgF.Seek(13, SeekOrigin.Begin) '从第十三字节开始读取
PosSentinel = br.ReadInt32 '第13到17字节指示缩略图描述块的位置
DwgF.Seek(PosSentinel + 30, SeekOrigin.Begin) '将指针移到缩略图描述块的第31字节
TypePreview = br.ReadByte '第31字节为缩略图格式信息,2 为BMP格式,3为WMF格式
Select Case TypePreview
Case 1
Case 2, 3
PosBMP = br.ReadInt32 'DWG文件保存的位图所在位置
LenBMP = br.ReadInt32 '位图的大小
DwgF.Seek(PosBMP + 14, SeekOrigin.Begin) '移动指针到位图块
biBitCount = br.ReadInt16 '读取比特深度
DwgF.Seek(PosBMP, SeekOrigin.Begin) '从位图块开始处读取全部位图内容备用
BMPInfo = br.ReadBytes(LenBMP) '不包含文件头的位图信息
br.Close()
DwgF.Close()
With biH '建立位图文件头
.bfType = H4D42
If biBitCount 9 Then .bfSize = 54 + 4 * (2 ^ biBitCount) + LenBMP Else .bfSize = 54 + LenBMP
.bfReserved1 = 0 '保留字节
.bfReserved2 = 0 '保留字节
.bfOffBits = 14 + H28 + 1024 '图像数据偏移
End With
'以下开始写入位图文件头
bmpr.Write(biH.bfType) '文件类型
bmpr.Write(biH.bfSize) '文件大小
bmpr.Write(biH.bfReserved1) '0
bmpr.Write(biH.bfReserved2) '0
bmpr.Write(biH.bfOffBits) '图像数据偏移
bmpr.Write(BMPInfo) '写入位图
BMPF.Seek(0, SeekOrigin.Begin) '指针移到文件开始处
myImg = Image.FromStream(BMPF) '创建位图文件对象
Return myImg
bmpr.Close()
BMPF.Close()
End Select
Catch ex As Exception
Return Nothing
End Try
End Function
想找一段vb2010可用的,将窗口隐藏到系统托盘的代码
VB.net中已经有专门的控件做系统托盘了,比vb简单多了,下面的代码是最小化时隐藏到系统托盘,在单击托盘图标时复原的代码:
Public Class Form1
Dim OldState As FormWindowState
Private WithEvents NotifyIcon1 As New NotifyIcon
Private Sub Form1_Resize(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Resize
If Me.WindowState = FormWindowState.Minimized Then
NotifyIcon1.Icon = Me.Icon
Me.ShowInTaskbar = False
NotifyIcon1.Visible = True
Else
OldState = Me.WindowState
End If
End Sub
Private Sub NotifyIcon1_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles NotifyIcon1.Click
Me.WindowState = OldState
Me.ShowInTaskbar = True
NotifyIcon1.Visible = False
End Sub
End Class
文章题目:vb2010.net源码,net vb
当前URL:http://pwwzsj.com/article/hcdpoi.html