If ตัวแปรที่ตั้งขึ้น = ข้อมูลที่จะให้check then
Radiobutton1.checked = true
else if ตัวแปรที่ตั้งขึ้น = ข้อมูลที่จะให้check then
Radiobutton2.checked = true
end if
Dim strConn As String
strConn = "Data Source=.\SQLEXPRESS;Initial Catalog=SSPEGIS;Integrated Security=True"
Conn = New SqlConnection(strConn)
Dim sqlland As String = ""
sqlland = "SELECT * FROM land ORDER BY LANDID"
If IsFind = True Then
ds.Tables("land").Clear()
End If
da = New SqlDataAdapter(sqlland, Conn)
da.Fill(db)
Dim cmb As SqlCommandBuilder
cmb = New SqlCommandBuilder(da)
bin.DataSource = db
txtLANDID.DataBindings.Add("Text", bin, "LANDID")
txtPARCEL_CODE.DataBindings.Add("Text", bin, "PARCEL_CODE")
txtTAMBON_TH.DataBindings.Add("Text", bin, "TAMBON_TH")
txtDISTRICT_TH.DataBindings.Add("Text", bin, "DISTRICT_TH")
If sqlland = "1" Then
RadioButton1.Checked = True
ElseIf sqlland = "2" Then
RadioButton2.Checked = True
End If
Imports System.Data
Imports System.Data.SqlClient
Public Class Form2
Dim Conn As SqlConnection = New SqlConnection
Dim dt As New DataTable
Dim db As New DataTable
Private bin As New BindingSource
Dim ds As DataSet = New DataSet
Dim CurrentRecord As Integer = 0
Dim RecordCount As Integer = 0
Dim acProductList As New AutoCompleteStringCollection()
Private Sub Form2_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
Dim strConn As String
strConn = "Data Source=.\SQLEXPRESS;Initial Catalog=SSPEGIS;Integrated Security=True"
Conn = New SqlConnection(strConn)
Dim sqlland As String = ""
sqlland = "SELECT * FROM land ORDER BY LANDID"
If IsFind = True Then
ds.Tables("land").Clear()
End If
da = New SqlDataAdapter(sqlland, Conn)
da.Fill(db)
Dim cmb As SqlCommandBuilder
cmb = New SqlCommandBuilder(da)
bin.DataSource = db
txtPARCEL_CODE.DataBindings.Add("Text", bin, "PARCEL_CODE")
If CurrentRecord > 0 Then
If Convert.ToString(dt.Rows(CurrentRecord - 1).Item("LAND_RENTID")) = "1" Then
RadioButton1.Checked = True
ElseIf Convert.ToString(dt.Rows(CurrentRecord - 1).Item("LAND_RENTID")) = "2" Then
RadioButton2.Checked = True
End If
End If
End Sub
Private Sub btnNext_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
bin.Position += 1
End Sub
End Class
ช่วย หน่อยครับทำวิธีนี้ก้อยัง ไม่ได้เลยครับ ขึ้นอยู่เเต่มันไม่เลือก เมื่อกดปุ่ม next
Imports System.Data
Imports System.Data.SqlClient
Public Class Form2
Dim Conn As SqlConnection = New SqlConnection
Dim da As SqlDataAdapter
Dim dt As New DataTable
Private bin As New BindingSource
Dim CurrentRecord As Integer
Private Sub Form2_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
Dim strConn As String
strConn = "Data Source=.\SQLEXPRESS;Initial Catalog=SSPEGIS;Integrated Security=True"
Conn = New SqlConnection(strConn)
Dim sqlland As String = ""
sqlland = "SELECT * FROM land ORDER BY LANDID"
da = New SqlDataAdapter(sqlland, Conn)
da.Fill(dt)
Dim cmb As SqlCommandBuilder
cmb = New SqlCommandBuilder(da)
bin.DataSource = dt
txtPARCEL_CODE.DataBindings.Add("Text", bin, "PARCEL_CODE")
If Convert.ToString(dt.Rows(CurrentRecord).Item("LAND_RENTID")) = "1" Then
RadioButton1.Checked = True
ElseIf Convert.ToString(dt.Rows(CurrentRecord).Item("LAND_RENTID")) = "2" Then
RadioButton2.Checked = True
End If
End Sub
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
bin.Position += 1
End Sub
End Class
Imports System.Data
Imports System.Data.SqlClient
Public Class Form2
Dim Conn As SqlConnection = New SqlConnection
Dim da As SqlDataAdapter
Dim dt As New DataTable
Private bin As New BindingSource
Dim CurrentRecord As Integer
Private Sub Form2_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
Dim strConn As String
strConn = "Data Source=.\SQLEXPRESS;Initial Catalog=SSPEGIS;Integrated Security=True"
Conn = New SqlConnection(strConn)
Dim sqlland As String = ""
sqlland = "SELECT * FROM land ORDER BY LANDID"
da = New SqlDataAdapter(sqlland, Conn)
da.Fill(dt)
Dim cmb As SqlCommandBuilder
cmb = New SqlCommandBuilder(da)
bin.DataSource = dt
txtPARCEL_CODE.DataBindings.Add("Text", bin, "PARCEL_CODE")
End Sub
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
bin.Position += 1
If bin.Current("LAND_RENTID") = 1 Then
RadioButton1.Checked = True
Else
RadioButton2.Checked = True
End If
End Sub
End Class
Imports System.Data
Imports System.Data.SqlClient
Public Class Form2
Dim Conn As SqlConnection = New SqlConnection
Dim da As SqlDataAdapter
Dim dt As New DataTable
Private bin As New BindingSource
Dim CurrentRecord As Integer
Private Sub Form2_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
Dim strConn As String
strConn = "Data Source=.\SQLEXPRESS;Initial Catalog=SSPEGIS;Integrated Security=True"
Conn = New SqlConnection(strConn)
Dim sqlland As String = ""
sqlland = "SELECT * FROM land ORDER BY LANDID"
da = New SqlDataAdapter(sqlland, Conn)
da.Fill(dt)
Dim cmb As SqlCommandBuilder
cmb = New SqlCommandBuilder(da)
bin.DataSource = dt
Try
If Convert.ToString(dt.Rows(CurrentRecord).Item("PICTURE")) <> "" Then
PictureBox1.Image = Image.FromFile(Convert.ToString(dt.Rows(CurrentRecord).Item("PICTURE")))
Else
PictureBox1.Image = Nothing
End If
Catch
PictureBox1.Image = Nothing
End Try
End Sub
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
bin.Position += 1
If bin.Current("PICTURE") Then
End If
End Sub
End Class
เเต่ถ้า เป็นรูปภาพหละ ครับ เมื่อกด next ถัดไปละครับ ให้มันเปลี่ยนภาพด้วย