vb.net常用代码 VBNET教程

跪求vb.net代码

新建窗口,添加picture控件

为亳州等地区用户提供了全套网页设计制作服务,及亳州网站建设行业解决方案。主营业务为成都做网站、网站设计、亳州网站设计,以传统方式定制建设网站,并提供域名空间备案等一条龙服务,秉承以专业、用心的态度为用户提供真诚的服务。我们深信只要达到每一位用户的要求,就会得到认可,从而选择与我们长期合作。这样,我们也可以走得更远!

利用line()方法画线

line(开始x坐标,开始y坐标)-(结束x坐标,结束y坐标),线的颜色,画线的方式(默认为线,B为矩形无填充,BF为填充的矩形)

For i = 1 To 16

Picture1.Line (0, Picture1.Height / 2)-(i * (Picture1.Width / 16), 0), RGB(255, 0, 0)

Picture1.Line (0, Picture1.Height / 2)-(i * (Picture1.Width / 16), Picture1.Height), RGB(255, 0, 0)

Picture1.Line (Picture1.Width, Picture1.Height / 2)-(i * (Picture1.Width / 16), 0), RGB(0, 255, 0)

Picture1.Line (Picture1.Width, Picture1.Height / 2)-(i * (Picture1.Width / 16), Picture1.Height), RGB(0, 255, 0)

Next i

如果要在窗口上画也可以调用窗口的line方法即form.line()

求vb.net的源代码,最好说明其解决问题,越多越好,满意加50分。

下面这段代码,是我用来计算每个月存500元进银行,连续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

VB.NET中的代码

大概的过程:

Imports System.Data

Imports System.Data.SqlClient

--------------

Dim a As New SqlDataAdapter

Dim con As SqlConnection

con = New SqlConnection( "Persist Security Info=False;Integrated Security=SSPI;database=northwind;server=.;Connect Timeout=30")

con.Open()

a.SelectCommand = New SqlCommand("select * from table where c=1", con)

a.UpdateCommand = New SqlCommand("update table set b=2 where c=1", con)

a.DeleteCommand = New SqlCommand("delete from table where c=1", con)

a.InsertCommand = New SqlCommand("insert into table values (1,2,3)", con)

a.SelectCommand.ExecuteNonQuery()

a.UpdateCommand.ExecuteNonQuery()

a.DeleteCommand.ExecuteNonQuery()

a.InsertCommand.ExecuteNonQuery()

con.Close()

a.Dispose()

请问Vb.net编程代码,不要C语言的,我看不懂啊?

Imports System

Module Program

Sub Main()

Dim n As Integer

n=6

Console.WriteLine("{0}!={1}",n,fact(n))

n=10

For i As Integer=1 To n

Console.Write("{0}{1}",fibo(i),IIF(n=i,vbCrLf,","))

Next

Console.Write("按任意键继续。。。 ")

Console.ReadKey(True)

End Sub

' 递归算阶乘

Function fact(n As Long) As Long

If 0=n OrElse 1=n Then Return 1

Return n*fact(n-1)

End Function

' 递归算斐波那契数列

Function fibo(n As Long) As Long

If 1=n OrElse 2=n Then Return 1

Return fibo(n-1)+fibo(n-2)

End Function

End Module


当前名称:vb.net常用代码 VBNET教程
新闻来源:http://scyanting.com/article/dodgesd.html