网站首页 > 文章中心 > 其它

vb.net语言代码大全

作者:小编 更新时间:2023-09-21 07:30:47 浏览量:311人看过

vb代码翻译成vb.net代码

关于Visual Studio ,vb.net语言代码

100分求一个用VB.net做的简单网页的代码,谢谢!!!

vb.net语言代码大全-图1

用vb.net做的校友录......(附所有源代码)

想必大家都上过校友录吧,里面的功能虽然不是很强大,但是为我们这些毕业之后各奔西东的学子来说,到真是提供了一个好的聚集点,下面是我用vb.net做的校友录,当然也不能说是校友录了,只能说是我们班的学友录了:)不过只要你掌握了这种编程思想,校友录就不在话下了.这里我将重点谈一下关于管理员权限赋予.

今天这一节,我使用的是checkboxlist(两个),一个用来转换数据(visibe=fause),一个用来显示数据,还有一个checkbox用来写全部选中的事件.当然了还有两个按钮事件,一个是用来提升为管理员的,一个是用来降级为一般用户的,这两个按钮在判断为一般用户时

enable都是为fause的,只有当判断登录为管理员时才为true.当然了,如果你是班级创始人,是不可能被降级的:)

这里用来显示信息的我用的是一个datagrid,当判断为非管理员时,删除栏的visible将为fause,为管理员的时候,才为true,也就是说只有管理员才可以删除信息.而不是注册的用户是不能发言的所有的按钮控件的enable将都为fause.

代码如下:board.aspx

HTML

HEAD

title/title

meta content="javascript" name="vs_defaultClientScript"

meta content="" name="vs_targetSchema"

vb.net语言代码大全-图2

/HEAD

body background="image/bg.gif" MS_POSITIONING="GridLayout"

form id="Form1" method="post" runat="server"

Columns

/Columns

/asp:datagrid

/form

/body

/HTML

下面是codebehind中的内容:boaman.asp.vb

Imports System.Data

Imports System.Data.SqlClient

Public Class boaman

Inherits System.Web.UI.Page

Protected WithEvents yourcheck As System.Web.UI.WebControls.CheckBox

Protected WithEvents Button1 As System.Web.UI.WebControls.Button

Protected WithEvents CheckBoxList1 As System.Web.UI.WebControls.CheckBoxList

Protected WithEvents mycheck As System.Web.UI.WebControls.CheckBoxList

Protected WithEvents Label1 As System.Web.UI.WebControls.Label

Protected WithEvents Image1 As System.Web.UI.WebControls.Image

Protected WithEvents DataGrid1 As System.Web.UI.WebControls.DataGrid

#Region " Web Form Designer Generated Code "

'This call is required by the Web Form Designer.

System.Diagnostics.DebuggerStepThrough() Private Sub InitializeComponent()

End Sub

Private Sub Page_Init(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Init

'CODEGEN: This method call is required by the Web Form Designer

'Do not modify it using the code editor.

InitializeComponent()

#End Region

Private Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load

'////////////////////判断是否为过客

If Session("stu_id") = "" Then

'////////////////////调用check()事件

check()

Else

If Not IsPostBack Then

Dim comm As SqlCommand = New SqlCommand(sql, conn)

comm.Parameters("@stu_id").Value = Session("stu_id")

Dim dr As SqlDataReader

conn.Open()

dr = comm.ExecuteReader

While dr.Read

If dr.Item("term") = "0" Then

'///////////////////判断是否为一般用户

dr.Close()

Dim sql_1 As String = "select a.stu_id as stu_id,a.term,b.name as name,b.tel as tel,b.call as oicq,b.point as point,b.email from pwd a,stu_base b where a.stu_id=b.stu_id"

Dim cmd As New SqlCommand(sql_1, conn)

dr = cmd.ExecuteReader

If dr.Item("term") = "1" Then

mycheck.Items.Add("u" dr.Item("name") "/u" "font color=darkorange(管理员)/font")

mycheck.Items.Add("u" dr.Item("name") "/u" "font color=red(班级创始人)font")

mycheck.Items.Add("u" dr.Item("name") "/u")

End If

CheckBoxList1.Items.Add(dr.Item("stu_id"))

End While

'////////////////////判断是否为管理员

'////////////////////////取出数据,填充dataset

Dim mysql As String = "select a.stu_id as stu_id,a.term,b.name as name,b.tel as tel,b.call as oicq,b.point as point,b.email from pwd a,stu_base b where a.stu_id=b.stu_id"

comm = New SqlCommand(mysql, conn)

Dim mycomm As SqlDataAdapter = New SqlDataAdapter(mysql, conn)

Dim ds As DataSet = New DataSet()

mycomm.Fill(ds, "base")

DataGrid1.DataSource = ds.Tables("base").DefaultView

DataGrid1.DataBind()

'///////////////////////书写check()事件

Sub check()

Dim comm As New SqlCommand(mysql, conn)

'/////////////////////填充yourcheck

Private Sub yourcheck_CheckedChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles yourcheck.CheckedChanged

Dim i As Integer

For i = 0 To mycheck.Items.Count - 1

If yourcheck.Checked Then

mycheck.Items(i).Selected = True

mycheck.Items(i).Selected = False

Next

'///////////////////////提升一般用户为管理员

Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click

If mycheck.Items(i).Selected Then

Dim comm As SqlCommand = New SqlCommand(sql_1, conn)

comm.Parameters("@stu_id").Value = CheckBoxList1.Items(i).Text

comm.ExecuteNonQuery()

Response.Redirect("boaman.aspx")

'///////////////////////降级管理员为一般用户

End Class

当然了,这里面还有好多不足的地方,恳求高手批评指正.

校友录还有一些其它的功能就很简单了,这里就不再探讨了.

用VB.NET程序编写代码

Delphi代码如下:

procedure?TForm1.Button1Click(Sender:?TObject);

var

购物总价:Integer;

折扣:Extended;

begin

购物总价:=StrToInt(Edit1.Text);

折扣:=0;

end

else?if?购物总价1000?then

折扣:=0.1;

{

此段的折扣是多少?

}

end;

ShowMessage('您享受的折扣是:'+FloatToStr(折扣)

? +'?原价:'+IntToStr(购物总价)

? +'?折后总价:'+FloatToStr(购物总价*(1-折扣)));

跪求vb.net代码

这个其实跟桃形或者心形(另一问题中提到的)其实是一个程序,改一下花瓣的半径就可以了.请看图

通过圆心的垂直线的距离为半径

圆心右侧垂直线的距离为半径

圆心左侧垂直线的距离为半径

过圆上左极点垂直线的距离为半径

与上次的桃形绘图的代码差异只有一句

以上就是土嘎嘎小编为大家整理的vb.net语言代码大全相关主题介绍,如果您觉得小编更新的文章只要能对粉丝们有用,就是我们最大的鼓励和动力,不要忘记讲本站分享给您身边的朋友哦!!

版权声明:倡导尊重与保护知识产权。未经许可,任何人不得复制、转载、或以其他方式使用本站《原创》内容,违者将追究其法律责任。本站文章内容,部分图片来源于网络,如有侵权,请联系我们修改或者删除处理。

编辑推荐

热门文章