真实的国产乱ⅩXXX66竹夫人,五月香六月婷婷激情综合,亚洲日本VA一区二区三区,亚洲精品一区二区三区麻豆

成都創(chuàng)新互聯(lián)網(wǎng)站制作重慶分公司

包含vb點虐 num的詞條

VB點虐 ,小數(shù)點直接進(jìn)一位的函數(shù)?

'自定義一個函數(shù):功能是給小數(shù)直接進(jìn)一位

從事多線服務(wù)器托管,服務(wù)器租用,云主機(jī),虛擬主機(jī),主機(jī)域名,CDN,網(wǎng)絡(luò)代維等服務(wù)。

'num  要操作的小數(shù)

'n 保留幾位小數(shù),

Function getNumber(num As Double, n As Integer) As Double

Dim a As Double

a = Int(num * (10 ^ n)) / (10 ^ n)

If a = num Then

getNumber = a

Else

getNumber = a + 1 / (10 ^ n)

End If

End Function

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

調(diào)用一下:

Private Sub Command1_Click()

MsgBox (getNumber(3.1415926, 2))

End Sub

得到3.15

vb點虐 提取特定字符串

在VB中是這樣的,沒學(xué)過VB點虐 ,你變換一下就可以了

Option

Explicit

Private

Sub

Command1_Click()

Dim

Num(2)

Num(0)

=

Val(Left(Label1.Caption,

2))

Num(1)

=

Val(Mid(Label1.Caption,

3,

1))

Num(2)

=

Val(Right(Label1.Caption,

2))

MsgBox

"Num(0)="

Num(0)

vbCrLf

"Num(1)="

Num(1)

vbCrLf

"Num(2)="

Num(2)

'如果想測試是不是可以計算,可以用這一句

'MsgBox

"Num(0)+1="

Num(0)

+

1

vbCrLf

"Num(1)+1="

Num(1)

+

1

vbCrLf

"Num(2)+1="

Num(2)

+

1

End

Sub

Private

Sub

Form_Load()

Label1.Caption

=

"12345"

End

Sub

使用vb點虐 的字符串

用字符串保存兩個數(shù)據(jù),當(dāng)然只有你這種辦法,另外提供你其它思路:

1. flexcell增加兩列,這兩列隱藏不顯示,額外數(shù)據(jù)可以從這兩列讀取

2. 用自定義類型數(shù)組,保存這兩列數(shù)據(jù),數(shù)組順序和表格一樣,或者數(shù)組中增加一個ID元素,與表格對應(yīng)

vb點虐 中 sql查詢出來的值,比如books中的remainnum,賦給一個變量 num,再將num-1之后update到remainnum中

Dim num As Integer

Dim connstr, insertcmd, selectcmd As String

connstr = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=D:\360data\重要數(shù)據(jù)\我的文檔\hd.mdb"

Dim conn As OleDbConnection

Dim cmd, cmd1 As OleDbCommand

conn = New OleDbConnection(connstr)

Dim r As OleDbDataReader

conn.Open()

insertcmd = "insert into returnbooks (aid,aname,ISBN,bname,renum,reday) values("

Val(ComboBox1.Text) ",'"

TextBox2.Text "','"

ComboBox2.Text "','"

TextBox2.Text "',"

Val(TextBox3.Text) ",'"

CType(TextBox4.Text, Date) "' )"

cmd = New OleDbCommand(insertcmd, conn)

cmd.ExecuteNonQuery()

updatecmd = "update books set remainnum=" Val(num) "-" Val(TextBox3.Text) " where ISBN='" ComboBox2.Text "'"

cmd = New OleDbCommand(updatecmd, conn)

cmd.ExecuteNonQuery()

updatecmd = "select remainnum as num from books where ISBN= '" ComboBox2.Text "'"

cmd = New OleDbCommand(updatecmd, conn)

cmd.ExecuteNonQuery()

updatecom = "update books set remainnum=num+ " Val(TextBox3.Text) ""

cmd = New OleDbCommand(updatecmd, conn)

cmd.ExecuteNonQuery()

selectcmd = "select remainnum from books where ISBN='" ComboBox2.Text "'"

cmd1 = New OleDbCommand(selectcmd, conn)

r = cmd1.ExecuteReader()

If (r.Read()) Then '如果sql查詢到了數(shù)據(jù)

num = r.GetInt32(0)

End If

conn.Close()

/*注意代碼的格式,不然改起來太費時間*/


網(wǎng)頁標(biāo)題:包含vb點虐 num的詞條
標(biāo)題來源:http://weahome.cn/article/ddcggie.html

其他資訊

在線咨詢

微信咨詢

電話咨詢

028-86922220(工作日)

18980820575(7×24)

提交需求

返回頂部