可以用Replace把他替換成空或別的字符:Vb的TAB表示方式為:vbTab 例:Replace(內(nèi)容,vbTab,"")
創(chuàng)新互聯(lián)服務(wù)項(xiàng)目包括沙坡頭網(wǎng)站建設(shè)、沙坡頭網(wǎng)站制作、沙坡頭網(wǎng)頁(yè)制作以及沙坡頭網(wǎng)絡(luò)營(yíng)銷(xiāo)策劃等。多年來(lái),我們專(zhuān)注于互聯(lián)網(wǎng)行業(yè),利用自身積累的技術(shù)優(yōu)勢(shì)、行業(yè)經(jīng)驗(yàn)、深度合作伙伴關(guān)系等,向廣大中小型企業(yè)、政府機(jī)構(gòu)等提供互聯(lián)網(wǎng)行業(yè)的解決方案,沙坡頭網(wǎng)站推廣取得了明顯的社會(huì)效益與經(jīng)濟(jì)效益。目前,我們服務(wù)的客戶(hù)以成都為中心已經(jīng)輻射到沙坡頭省份的部分城市,未來(lái)相信會(huì)繼續(xù)擴(kuò)大服務(wù)區(qū)域并繼續(xù)獲得客戶(hù)的支持與信任!
str(22)把數(shù)字22轉(zhuǎn)化為字符串后,系統(tǒng)自動(dòng)在22前增加一個(gè)空格,即符號(hào)位(因?yàn)檎?hào)只占位),如果是負(fù)數(shù)則用-號(hào)占用符號(hào)位,所以str(22)的結(jié)果是“ 22”,長(zhǎng)度為3。
后面的str(3)=" 3",str(2)=" 2",它們的字符串的長(zhǎng)度都是2(包括了一個(gè)符號(hào)位空格)。
所以:Len(Str(22) + Str(3) + Str(2))=len(" 22"+" 3"+" 2")=len(" 22 3 2")=7
TextBox1.Text?=?7?And?10
TextBox1.Text?=?7?Or?10
TextBox1.Text?=?7?Xor?10
TextBox1.Text?=?Not?10
TextBox1.Text?=?7??10
TextBox1.Text?=?7??10
如這些,我在VB.Net中也找不到shl和shr運(yùn)算符~
不過(guò)可以通過(guò)"自定義運(yùn)算符"來(lái)寫(xiě)出我們想要的功能
IE的收藏夾導(dǎo)入可以導(dǎo)入,IE瀏覽器,文件——導(dǎo)入和導(dǎo)出,選擇導(dǎo)入收藏夾,然后選擇遨游的導(dǎo)出的htm文件,即可。
在C:\\Documents and Settings\\Administrator(用戶(hù)名)\\Favorites 文件夾下,就是以文件夾格式了。
注意只能對(duì)整型執(zhí)行按位運(yùn)算。浮點(diǎn)值必須轉(zhuǎn)換為整型后,才能執(zhí)行按位運(yùn)算。按位運(yùn)算采用二進(jìn)制(以 2 為基)形式計(jì)算兩個(gè)整數(shù)值。它們比較對(duì)應(yīng)位置上的位,然后基于比較的結(jié)果賦值。下面的示例演示了 And 運(yùn)算符。復(fù)制Dim x As Integerx = 3 And 5 前面的示例將 x 的值設(shè)置為 1。發(fā)生這種情況的原因如下:這些值以二進(jìn)制形式處理:二進(jìn)制格式的 3 為 011二進(jìn)制格式的 5 為 101And 運(yùn)算符比較這些二進(jìn)制表示方式,一次比較一個(gè)二進(jìn)制位置(位)。如果給定位置的兩個(gè)位都為 1,則將 1 放在結(jié)果中的該位置。如果任何一個(gè)位是 0,則將 0 放在結(jié)果中的該位置。在前面的示例中,按如下所示計(jì)算結(jié)果:011(二進(jìn)制格式的 3)101(二進(jìn)制格式的 5)001(二進(jìn)制格式的計(jì)算結(jié)果)計(jì)算結(jié)果以十進(jìn)制形式處理。值 001 是 1 的二進(jìn)制表示形式,因此 x = 1。除了在任何一個(gè)比較位是 1 或兩個(gè)比較位都是 1 的情況下將 1 賦予結(jié)果位以外,按位 Or 運(yùn)算與此類(lèi)似。Xor 在比較的位正好只有一個(gè)是 1(而不是兩者都是 1)時(shí)將 1 賦給結(jié)果位。Not 采用單個(gè)操作數(shù)并反轉(zhuǎn)所有位(包括符號(hào)位),然后將該值賦予結(jié)果。這意味著,對(duì)于有符號(hào)正數(shù),Not 始終返回負(fù)值,而對(duì)于負(fù)數(shù),Not 始終返回正值或零。AndAlso 和OrElse 運(yùn)算符不支持按位運(yùn)算。 追問(wèn): 好復(fù)雜啊...還是不會(huì),還有整數(shù)怎么轉(zhuǎn)換為二進(jìn)制數(shù)? 回答: 為什么一定要用位運(yùn)算呢,你那個(gè)乘法只能通過(guò)左移操作符“ ”來(lái)進(jìn)行,而左移一次代表乘以2,要是乘以一個(gè)小數(shù),就必須先化成2的n次方,不夠再用加減法調(diào)整,很麻煩啊,沒(méi)必要用位運(yùn)算啊。。。 追問(wèn): 因?yàn)槲乙M(jìn)行大量的運(yùn)算,但速度要快,所有用位運(yùn)算...我也不想啊.. 回答: 那就不該用VB 啊,c/c++在執(zhí)行效率上是沒(méi)話(huà)說(shuō)的。 追問(wèn): 問(wèn)題就是不會(huì)嘛... 回答: 那你上csdn上發(fā)帖效果應(yīng)該不錯(cuò) 追問(wèn): CSDN發(fā)了,我發(fā)在高性能運(yùn)算,沒(méi)人... 回答: 耐心一些,或者你應(yīng)該發(fā)到VB.NET論壇那里。。。 追問(wèn): 額..只能這樣了... 提問(wèn)者 的感言: 太復(fù)雜了..算了 2010-11-08
這是運(yùn)行過(guò)的程序:(VB.NET)
Imports System.Data
Imports System.Data.SqlClient
Public Class WebForm3
Inherits System.Web.UI.Page
#Region " Web 窗體設(shè)計(jì)器生成的代碼 "
'該調(diào)用是 Web 窗體設(shè)計(jì)器所必需的。
System.Diagnostics.DebuggerStepThrough() Private Sub InitializeComponent()
End Sub
Protected WithEvents Label5 As System.Web.UI.WebControls.Label
Protected WithEvents DropDownList1 As System.Web.UI.WebControls.DropDownList
Protected WithEvents Label1 As System.Web.UI.WebControls.Label
Protected WithEvents DataGrid1 As System.Web.UI.WebControls.DataGrid
Protected WithEvents Button1 As System.Web.UI.WebControls.Button
Protected WithEvents Button2 As System.Web.UI.WebControls.Button
'注意: 以下占位符聲明是 Web 窗體設(shè)計(jì)器所必需的。
'不要?jiǎng)h除或移動(dòng)它。
Private designerPlaceholderDeclaration As System.Object
Private Sub Page_Init(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Init
'CODEGEN: 此方法調(diào)用是 Web 窗體設(shè)計(jì)器所必需的
'不要使用代碼編輯器修改它。
InitializeComponent()
End Sub
#End Region
Dim objConnection As New System.Data.SqlClient.SqlConnection
Dim objDataAdapter As New System.Data.SqlClient.SqlDataAdapter
Dim objDataSet As New DataSet
Dim objDataView1 As New DataView
Dim objDataView2 As New DataView
Dim objDataView3 As New DataView
Dim objDataView4 As New DataView
Private Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
'在此處放置初始化頁(yè)的用戶(hù)代碼
Me.objConnection.ConnectionString = System.Configuration.ConfigurationSettings.AppSettings("connstr")
Me.objDataAdapter.SelectCommand = New System.Data.SqlClient.SqlCommand
Me.objDataAdapter.SelectCommand.Connection = objConnection
Me.objDataAdapter.SelectCommand.CommandText = "select * from fb_baseinfo"
'綁定數(shù)據(jù)到DataSet
Me.objConnection.Open()
Me.objDataAdapter.Fill(objDataSet, "fb_baseinfo")
Me.objConnection.Close()
Me.objDataAdapter = Nothing
Me.objConnection = Nothing
End Sub
Private Sub DropDownList1_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles DropDownList1.SelectedIndexChanged
DataGrid1.Dispose() '清空DataGrid1控件的內(nèi)容
If Me.DropDownList1.SelectedValue = "1" Then
' Me.objDataAdapter.Fill(objDataSet, "fb_baseinfo")
'Me.objDataView = New DataView(Me.objDataSet.Tables("fb_baseinfo"))
Me.objDataView1 = Me.objDataSet.Tables("fb_baseinfo").DefaultView
Me.objDataView1.RowFilter = "sort_id=1"
Me.DataGrid1.DataSource = objDataView1
Me.DataGrid1.DataMember = "fb_baseinfo"
Me.DataGrid1.DataBind()
End If
If Me.DropDownList1.SelectedValue = "2" Then
Me.objDataView2 = Me.objDataSet.Tables("fb_baseinfo").DefaultView
Me.objDataView2.RowFilter = "sort_id=2"
Me.DataGrid1.DataSource = objDataView2
Me.DataGrid1.DataMember = "fb_baseinfo"
Me.DataGrid1.DataBind()
End If
If Me.DropDownList1.SelectedValue = "3" Then
Me.objDataView3 = Me.objDataSet.Tables("fb_baseinfo").DefaultView
Me.objDataView3.RowFilter = "sort_id=3"
Me.DataGrid1.DataSource = Me.objDataView3
Me.DataGrid1.DataMember = "fb_baseinfo"
Me.DataGrid1.DataBind()
End If
If Me.DropDownList1.SelectedValue = "4" Then
Me.objDataView4 = Me.objDataSet.Tables("fb_baseinfo").DefaultView
Me.objDataView4.RowFilter = "sort_id=4"
Me.DataGrid1.DataSource = Me.objDataView4
Me.DataGrid1.DataMember = "fb_baseinfo"
Me.DataGrid1.DataBind()
End If
End Sub
Private Sub DataGrid1_ItemCommand(ByVal source As Object, ByVal e As System.Web.UI.WebControls.DataGridCommandEventArgs) Handles DataGrid1.ItemCommand
'修改內(nèi)容
Dim objConnection As New SqlConnection
Dim objDataAdapter As New SqlDataAdapter
If e.CommandName.Equals("Delete") Then
objConnection.ConnectionString = System.Configuration.ConfigurationSettings.AppSettings("connstr")
objConnection.Open()
objDataAdapter.SelectCommand = New SqlCommand
objDataAdapter.SelectCommand.Connection = objConnection
objDataAdapter.SelectCommand.CommandText = "select * from fb_baseinfo"
Dim cmd As New System.Data.SqlClient.SqlCommand
cmd.Connection = objConnection
cmd.CommandText = "delete from fb_baseinfo where id=" Me.DataGrid1.Items(e.Item.ItemIndex).Cells(2).Text
cmd.ExecuteNonQuery()
objConnection.Close()
DataGrid1.Dispose() '清空DataGrid1控件的內(nèi)容
objDataSet.Clear() '清空DataSet對(duì)象的內(nèi)容(數(shù)據(jù)集)
If Me.DropDownList1.SelectedValue = "1" Then
objConnection.Open()
objDataAdapter.Fill(objDataSet, "fb_baseinfo")
objConnection.Close()
objDataView1 = Me.objDataSet.Tables("fb_baseinfo").DefaultView
objDataView1.RowFilter = "sort_id=1"
DataGrid1.DataSource = objDataView1
DataGrid1.DataMember = "fb_baseinfo"
DataGrid1.DataBind()
End If
If Me.DropDownList1.SelectedValue = "2" Then
objConnection.Open()
objDataAdapter.Fill(objDataSet, "fb_baseinfo")
objConnection.Close()
objDataView2 = Me.objDataSet.Tables("fb_baseinfo").DefaultView
objDataView2.RowFilter = "sort_id=2"
DataGrid1.DataSource = objDataView2
DataGrid1.DataMember = "fb_baseinfo"
DataGrid1.DataBind()
End If
If Me.DropDownList1.SelectedValue = "3" Then
objConnection.Open()
objDataAdapter.Fill(objDataSet, "fb_baseinfo")
objConnection.Close()
objDataView3 = Me.objDataSet.Tables("fb_baseinfo").DefaultView
objDataView3.RowFilter = "sort_id=3"
DataGrid1.DataSource = Me.objDataView3
DataGrid1.DataMember = "fb_baseinfo"
DataGrid1.DataBind()
End If
If Me.DropDownList1.SelectedValue = "4" Then
objConnection.Open()
objDataAdapter.Fill(objDataSet, "fb_baseinfo")
objConnection.Close()
objDataView4 = Me.objDataSet.Tables("fb_baseinfo").DefaultView
objDataView4.RowFilter = "sort_id=4"
DataGrid1.DataSource = Me.objDataView4
DataGrid1.DataMember = "fb_baseinfo"
DataGrid1.DataBind()
End If
objConnection = Nothing
objDataAdapter = Nothing
End If
'刪除內(nèi)容
If e.CommandName.Equals("update") Then
Response.Redirect("updata.aspx?id=" Me.DataGrid1.Items(e.Item.ItemIndex).Cells(2).Text)
End If
End Sub
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Response.Redirect("index.aspx")
End Sub
Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
Response.Redirect("insert.aspx")
End Sub
End Class