代码转换
我以前学过vb6.0,学的还不错,现在想学VB NET。请各位帮忙转换一下下面的两个代码。第一个:(是一个数据库,不存图片只存路径,Command1是插入图片按钮,Text1是存取图片文件路径,Image1是用来显示Text1.tex的图片,如果不选取图片原图片不动)
Private Sub Command1_Click()
CommonDialog1.filename = Text1.Text
CommonDialog1.Filter = "图象文件[*.jpg:*.BMP]|*.jpg;*.BMP"
CommonDialog1.DialogTitle = "请选择图象文件名"
CommonDialog1.ShowOpen
If Err <> vbCancel Then
Dim filename As String
Text1.SetFocus
filename = CommonDialog1.filename
Text1.Text = filename
Image1.Picture = LoadPicture(Text1.Text)
CommonDialog1.filename = ""
Else
End If
End Sub
第二个:(这是一个查询)
Private Sub Text4_Change()
datPrimaryRS2.RecordSource = "select * from biao where (biao." & Combo1.Text & " like + '" + Text4.Text + "'+'%')"
datPrimaryRS2.Refresh
End Sub