|  | 
	                
  
    |  |  
    | 
        
        ดึงรูปภาพจากโฟล์เดอร์ขึ้นมาโชว์ทั้งหมด กดปุ่ม เพื่อเลื่อน เดินหน้า ถอยหลังได้....     |  
    |  |  
 
              
  
    | 
 
 
 
        
          |  |  |  |  |  
          |  |  | 
            
              | ก็เพิ่มเิติมนิดหน่อยเองนี้ครับ ที่ Gridview ตอนเราเลิกก็แค่เอา String มาเชื่อมกันไม่น่ายากนิครับ 
 |  
              | 
                
                  |  |  |  |  
                  |  | 
                      
                        | Date :
                            2011-07-11 16:17:38 | By :
                            kaimuk |  |  |  
                  |  |  |  |  |  |  |  
          |  |  |  |  |  
 
 
        
          |  |  |  |  |  
          |  |  | 
            
              | txtCode.Text คืออะไรครับ แล้วการกด CellMouseClick ที่ Datagridviews ก็ไม่เห็นมีการส่งค่าไปที่ txtCode.Text 
 การใช้ Timer ก็ดูไม่เกิดประโยชน์ด้วยครับแถมเป็นการทรมาน ทรัพยากรเครื่องด้วย
 
 เอา
 
 pictures = System.IO.Directory.GetFiles("D:\Pictures\'" & txtCode.Text & "'") '--พาธไฟล์
 Picturebox1.Image = System.Drawing.Image.FromFile(pictures(picture_number))
 
 ใส่ไว้ที่ CellMouseClick เลยก็ได้ครับ
 
 แล้วที่ Button_Click
 ให้เพิ่มเขียนประมาณนี้ (ถ้าเอาตามโคลงเดิมของ จขกท.)
 
 picture_number = (picture_number + 1) Mod pictures.Length
 Picturebox1.Image = System.Drawing.Image.FromFile(pictures(picture_number))
 
 แล้วเอา Timer ออกไป
 
 ***ค่า txtCode.Text คืออะไรครับ
 
 |  
              | 
                
                  |  |  |  |  
                  |  | 
                      
                        | Date :
                            2011-07-12 11:47:58 | By :
                            kaimuk |  |  |  
                  |  |  |  |  |  |  |  
          |  |  |  |  |  
 
 
        
          |  |  |  |  |  
          |  |  | 
            
              | ผมสร้างตัวอย่างที่คิดว่าตรงที่สุดสำหรับ จขกท. นะครับติดตรงไหนหรือไม่เข้าใจถามได้นะครับ จาก Code ของ จขกท. ดูว่าพื้นฐานยังไม่ค่อยดีเท่าไหล่ ดู Code แล้วมองภาพตามและก็ทำความเข้าใจนะครับ จะได้เป็นการฝึกฝนไปในตัว 
 Code (VB.NET)
 
 Public Class Form1
    Dim ListFile() As String
    Dim _Index As Integer = 0
    Dim _Main As String = Application.StartupPath & "\Annimal\"
    Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
        DataGridView1.Rows.Add("สัตว์บก")
        DataGridView1.Rows.Add("สัตว์น้ำ")
        DataGridView1.Rows.Add("สัตว์ปีก")
    End Sub
    Private Sub DataGridView1_CellMouseDoubleClick(ByVal sender As Object, ByVal e As System.Windows.Forms.DataGridViewCellMouseEventArgs) Handles DataGridView1.CellMouseDoubleClick
        _Index = 0
        ListFile = Directory.GetFiles(_Main & DataGridView1.Rows(e.RowIndex).Cells(0).Value, "*.JPG")
        Label1.Text = "จำนวนภาพ : " & ListFile.Length
        Label2.Text = "ภาพที่ : " & _Index + 1
        If ListFile.Length <> 0 Then
            PictureBox1.Image = Image.FromFile(ListFile(_Index))
            Button1.Enabled = False
            Button2.Enabled = IIf(ListFile.Length = 1, False, True)
        Else
        PictureBox1.Image = Nothing
        Button1.Enabled = False
        Button2.Enabled = False
        End If
    End Sub
    Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
        _Index -= 1
        Label2.Text = "ภาพที่ : " & _Index + 1
        PictureBox1.Image = Image.FromFile(ListFile(_Index))
        Button2.Enabled = True
        If _Index = 0 Then Button1.Enabled = False
    End Sub
    Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
        _Index += 1
        Label2.Text = "ภาพที่ : " & _Index + 1
        PictureBox1.Image = Image.FromFile(ListFile(_Index))
        Button1.Enabled = True
        If _Index = ListFile.Length - 1 Then Button2.Enabled = False
    End Sub
End Class
 |  
              | 
                
                  |  |  |  |  
                  |  | 
                      
                        | Date :
                            2011-07-12 14:33:15 | By :
                            kaimuk |  |  |  
                  |  |  |  |  |  |  |  
          |  |  |  |  |  
 
 
        
          |  |  |  |  |  
          |  |  | 
            
              | _Main = Main Path น่ะครับ 
 ดังนั้น
 
 Code (VB.NET)
 
 Dim _Main As String = Application.StartupPath & "\Annimal\"
 
 จะเท่ากับ ที่อยู่ของ EXE File + \Annimal\ ไม่ต้องใส่ใจตรงนี้ก็ได้ครับ จขกท. เป็นแบบของตัวเองก็ได้ครับ
 
 เช่น ถ้า Main Path ของ จขกท. เป็น C:\Customer\ ก็ใส่แบบนี้แทนครับ
 
 Code (VB.NET)
 
 Dim _Main As String = "C:\Customer\ "
 
 |  
              | 
                
                  |  |  |  |  
                  |  | 
                      
                        | Date :
                            2011-07-13 08:30:59 | By :
                            kaimuk |  |  |  
                  |  |  |  |  |  |  |  
          |  |  |  |  |  
 
 
 
        
          |  |  |  |  |  
          |  |  | 
            
              | ขอ Path เต็มๆ ของ Folder 003 ด้วย เพราะ Error ฟ้องว่า Path ผิดน่ะครับ 
 Code ที่ให้ไปทำการตรวจสอบอยู่แล้วครับว่ามีไฟล์หรือไม่ ถ้าไม่มีจะไม่มีการแสดงรูป ครับ พร้อมกับปุ่มทั้ง 2 ปุ่มจะกดไม่ได้
 
 |  
              | 
 ประวัติการแก้ไข
 2011-07-13 09:27:11
 
                
                  |  |  |  |  
                  |  | 
                      
                        | Date :
                            2011-07-13 09:26:10 | By :
                            kaimuk |  |  |  
                  |  |  |  |  |  |  |  
          |  |  |  |  |  
 
 
        
          |  |  |  |  |  
          |  |  | 
            
              |  ตอบความคิดเห็นที่ : 13 เขียนโดย : สายน้ำ.. เมื่อวันที่ 2011-07-13 10:14:30 
 รายละเอียดของการตอบ ::
 พี่คะ.. มีพี่คนนึงให้โค๊ตการอ่านไฟล์มา เค้าบอกให้ไปอแด๊ปเอา..
 
Public Class Form1
 
    Inherits System.Windows.Forms.Form
 
    Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
 
        Dim Fso As New Scripting.FileSystemObject 
        Dim FD As Scripting.Folder 
        Dim File As Scripting.File
 
        FD = Fso.GetFolder("D:\Pictures\003\") '--ตรงนี้ 003 จะเปนกริดวิวเซลแรก ชื่อเดียวกับโฟลเดอร์ที่ใช้เก้บภาพย่อยๆๆ ถ้ามีโฟลเดอร์แต่ไม่มีรุป ก้ให้แจ้งเมสเสส หรือ ถ้าไม่มีโฟลเดอร์ก้ให้เชค
 
        TxtFile.Text = "" '--ตรงนี้เค้าเขียนจำลองการอ่านไฟล์มาให้ดูน่ะค่ะ 
        For Each File In FD.Files 
            TxtFile.Text = TxtFile.Text & File.Name & vbNewLine  '--เค้าบอกว่า ให้ เอาไฟล์ที่อ่านได้ มาเช้คเอาเฉพาะ .jpg แร้วเอาไปเก้บในตัวแปลอาเรย์ แร้วเอา ในอาเรย์ไปโชว์ Picturebox โชว์รุปแรก แร้วก้เลื่อนรูปถัดไป เดินหน้า ถอยหลังได้  
        Next File 
        FD = Nothing 
    End Sub 
End Class
 
พี่ช่วยเขียนให้ดูหน่อยจะได้มั้ยคะ.. เอาจากโค๊ตนี้อ่ะค่ะ เกรงใจ+ เอือมตัวเองจังเรย เส้าใจจัง..+
 |  
              | 
                
                  |  |  |  |  
                  |  | 
                      
                        | Date :
                            2011-07-13 10:32:50 | By :
                            คนเดิมมมมมม.. |  |  |  
                  |  |  |  |  |  |  |  
          |  |  |  |  |  
 
        
          |  |  |  |  |  
          |  |  | 
            
              | ก็แทบจะไม่ต่างเลยนะครับกับ Code ชุดบน ถ้า จขกท. พอจะมีพื้นมาบ้างจริงๆ น่าจะดูรู้เลยว่าแทบจะไม่แตกต่างกันเลย ที่นี้ต้องมา Focus ว่า จขกท. มีความรู้ในการเขียนโปรแกรมมากขนาดไหน แล้วจะเอา Code ไปทำอะไร การบ้าน หรือ งานที่ต้องส่ง 
 จขกท. ทดลองเปลี่ยน Code บรรทัดที่ 4 (ของ ความเห็นที่ 7) เป็น
 
 Code (VB.NET)
 
 Dim _Main As String = "D:\Pictures\"
 
 แล้วลอง Run ใหม่ครับ ดูว่าทำงานได้หรือไม่
 
 |  
              | 
                
                  |  |  |  |  
                  |  | 
                      
                        | Date :
                            2011-07-13 11:38:43 | By :
                            kaimuk |  |  |  
                  |  |  |  |  |  |  |  
          |  |  |  |  |  
 
 
        
          |  |  |  |  |  
          |  |  | 
            
              | ลบกวน จขกท. แปะ Code ทั้งหมด ของ Class frmSlideShow ในตอนนี้ด้วยครับจะได้ไล่ได้ถูกว่าปัญหาเกิดจากอะไร ลบกวนด้วยครับ 
 |  
              | 
                
                  |  |  |  |  
                  |  | 
                      
                        | Date :
                            2011-07-13 13:27:04 | By :
                            kaimuk |  |  |  
                  |  |  |  |  |  |  |  
          |  |  |  |  |  
 
        
          |  |  |  |  |  
          |  |  | 
            
              |  ตอบความคิดเห็นที่ : 17 เขียนโดย : kaimuk เมื่อวันที่ 2011-07-13 13:27:04 
 รายละเอียดของการตอบ ::
 โค๊ตทั้งหมดของฟอร์มนี้ค่ะ... 
- ฟอร์มโหลดมา จะโหลดโซนของลูกค้าขึ้นมา ให้เลือก 
- มี Radiobutton ให้เลือก ตามประเภทสินค้า กับ ทุกประเภท คลิก ปุ่มค้นหา จะโหลดข้อมูล มาโชว์กริดวิว 
- คลิกที่กริดวิว จะดึง ข้อมูลไปโชว์เทกบ้อกช่องต่างๆ แร้วก้ เซลแรกเปนรหัสลูกค้า ซึ่งจะเปนชื่อเด่วกับโฟลเดอร์ที่ใช้เก้บรูปภาพต่างๆของแต่ละคนค่ะ
Code (VB.NET) Imports System.Windows.Forms
Imports System.Data
Imports System.Data.OleDb
Imports System.IO
Public Class frmSlideShow
    Dim Cn As OleDbConnection
    Dim Cm As OleDbCommand
    Dim dr As OleDbDataReader
    Dim dt As DataTable
    Dim IniFile As New Clini(App_Path() & "ConF.ini")
    Dim StrFile As String
    Dim RootDirectory As String
    Dim ListFile() As String
    Dim _Index As Integer
    Dim _Main As String = Application.StartupPath & "D:\Pictures\"
       Private Sub frmSlideShow_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
        Connstring = "Provider = Microsoft.Jet.OLEDB.4.0;Data Source="
        StrFile = IniFile.GetString("Database", "Server", "Error File")
        Connstring = Connstring & StrFile
        Connstring = Connstring & "Persist Security Info = False"
        Cn = New OleDbConnection(Connstring)
        Cn.Open()
        RootDirectory = IniFile.GetString("Directory", "Root", "Error File")
        Dim str As String = ""
        str = "SELECT * FROM TBZONE"
        Cm = New OleDbCommand(str, Cn)
        dr = Cm.ExecuteReader
        dr.Read()
        dt = New DataTable
        dt.Load(dr)
        With ComboBox1
            .DisplayMember = "ZoneName"
            .ValueMember = "ZoneCode"
            .DataSource = dt
        End With
        Dim str1 As String = ""
        str1 = "SELECT * FROM TBTypeProduct"
        Cm = New OleDbCommand(str1, Cn)
        dr = Cm.ExecuteReader
        dr.Read()
        dt = New DataTable
        dt.Load(dr)
        With ComboBox2
            .DisplayMember = "TypeName"
            .ValueMember = "TypeCode"
            .DataSource = dt
        End With
    End Sub
    Private Sub GridviewList()
        With DataGridView1
            If .RowCount > 0 Then
                .Columns(0).HeaderText = "รหัสลูกค้า"
                .Columns(1).HeaderText = "รหัสลูกค้า"
                .Columns(2).HeaderText = "ชื่อลูกค้า"
                .Columns(0).Width = 130
                .Columns(1).Width = 100
            End If
        End With
    End Sub
    '--คลิก กริดวิว ลูกค้า
    Private Sub DataGridView1_CellMouseClick(ByVal sender As Object, ByVal e As System.Windows.Forms.DataGridViewCellMouseEventArgs) Handles DataGridView1.CellMouseClick
        _Index = 0
        ListFile = Directory.GetFiles(_Main & DataGridView1.Rows(e.RowIndex).Cells(0).Value, "*.JPG") '--Error บรรทัดนี้ค่ะ
        Label3.Text = "จำนวนภาพ : " & ListFile.Length
        Label4.Text = "ภาพที่ : " & _Index + 1
        If ListFile.Length <> 0 Then
            Picturebox1.Image = Image.FromFile(ListFile(_Index))
            Button1.Enabled = False
            Button2.Enabled = IIf(ListFile.Length = 1, False, True)
        Else
            Picturebox1.Image = Nothing
            Button1.Enabled = False
            Button2.Enabled = False
        End If
        If e.RowIndex < 0 Then
            Exit Sub
        End If
        With DataGridView1.Rows.Item(e.RowIndex)
            txtCode.Text = .Cells(0).Value
            txtName1.Text = .Cells(2).Value
            Dim strSearch As String = ""
            strSearch = "select * from QryCustomer where CODE = '" & txtCode.Text & "'" '--รหัสลูกค้า
            Cm = New OleDbCommand(strSearch, Cn)
            dr = Cm.ExecuteReader
            If dr.HasRows Then
                Do While dr.Read()
                    If dr("NAME2") Is DBNull.Value Then
                        txtName2.Text = "-"
                    Else
                        txtName2.Text = dr("NAME2")
                    End If
                    If dr("NameGroup") Is DBNull.Value Then
                        txtTypegroup.Text = "-"
                    Else
                        txtTypegroup.Text = dr("NameGroup")
                    End If
                    If dr("Address") Is DBNull.Value Then
                        txtAddress.Text = "-"
                    Else
                        txtAddress.Text = dr("Address")
                    End If
                    If dr("Road") Is DBNull.Value Then
                        txtRoad.Text = "-"
                    Else
                        txtRoad.Text = dr("Road")
                    End If
                    If dr("Tom") Is DBNull.Value Then
                        txtTum.Text = "-"
                    Else
                        txtTum.Text = dr("Tom")
                    End If
                    If dr("Amp") Is DBNull.Value Then
                        txtAum.Text = "-"
                    Else
                        txtAum.Text = dr("Amp")
                    End If
                    If dr("City") Is DBNull.Value Then
                        txtCity.Text = "-"
                    Else
                        txtCity.Text = dr("City")
                    End If
                    If dr("Tel") Is DBNull.Value Then
                        txtTel.Text = "-"
                    Else
                        txtTel.Text = dr("Tel")
                    End If
                    If dr("DateLast") Is DBNull.Value Then
                        txtDateLast.Text = "-"
                    Else
                        txtDateLast.Text = dr("DateLast")
                    End If
                    If dr("SN") Is DBNull.Value Then
                        txtSN.Text = "-"
                    Else
                        txtSN.Text = dr("SN")
                    End If
                    If dr("GP") Is DBNull.Value Then
                        txtGP.Text = "-"
                    Else
                        txtGP.Text = dr("GP")
                    End If
                    If dr("Rent") Is DBNull.Value Then
                        txtRent.Text = "-"
                    Else
                        txtRent.Text = dr("Rent")
                    End If
                    If dr("At") Is DBNull.Value Then
                        txtAt.Text = "-"
                    Else
                        txtAt.Text = dr("At")
                    End If
                    If dr("DateAt") Is DBNull.Value Then
                        txtDateAt.Text = "-"
                    Else
                        txtDateAt.Text = dr("DateAt")
                    End If
                    If dr("ZoneName") Is DBNull.Value Then
                        txtZone.Text = "-"
                    Else
                        txtZone.Text = dr("ZoneName")
                    End If
                    If dr("TypeName") Is DBNull.Value Then
                        txtTypeName.Text = "-"
                    Else
                        txtTypeName.Text = dr("TypeName")
                    End If
                Loop
            Else
                MsgBox("ไม่พบข้อมูล")
            End If
        End With
    End Sub
    '--ปุ่มค้นหา
    Private Sub Button3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button3.Click
        Dim strSearch As String = ""
        If RadioButton2.Checked = True Then '--ตามประเภทสินค้า
            strSearch = " SELECT CODE,CODESC,NAME1 from qrycustomer where [Zone] = '" & ComboBox1.SelectedValue & "' and GroupType = '" & ComboBox2.SelectedValue & "'"
            Cm = New OleDbCommand(strSearch, Cn)
            dr = Cm.ExecuteReader
            If dr.HasRows Then
                dt = New DataTable
                dt.Load(dr)
                DataGridView1.DataSource = dt
                GridviewList()
            Else
                MessageBox.Show("ไม่พบข้อมูล !!!..  & กรุณาค้นหาใหม่ ", "", MessageBoxButtons.OK, MessageBoxIcon.Warning)
                DataGridView1.DataSource = Nothing
                ClearTextAll()
                ClearTextAll2()
            End If
        Else '-- สินค้าทุกประเภท
            strSearch = " SELECT CODE,CODESC,NAME1 from qrycustomer where [Zone] = '" & ComboBox1.SelectedValue & "' "
            Cm = New OleDbCommand(strSearch, Cn)
            dr = Cm.ExecuteReader
            If dr.HasRows Then
                dt = New DataTable
                dt.Load(dr)
                DataGridView1.DataSource = dt
                GridviewList()
            Else
                MessageBox.Show("ไม่พบข้อมูล !!!..  & กรุณาค้นหาใหม่ ", "", MessageBoxButtons.OK, MessageBoxIcon.Warning)
                DataGridView1.DataSource = Nothing
                ClearTextAll()
                ClearTextAll2()
            End If
        End If
    End Sub
    '--ประเภทสินค้า
    Private Sub RadioButton2_CheckedChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles RadioButton2.CheckedChanged
        If RadioButton2.Checked = True Then
            ComboBox2.Enabled = True
        End If
    End Sub
    '--สินค้าทุกประเภท
    Private Sub RadioButton1_CheckedChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles RadioButton1.CheckedChanged
        If RadioButton1.Checked = True Then
            ComboBox2.Enabled = False
        End If
    End Sub
    Private Sub ClearTextAll() '---เคลียร์ข้อมูลทั้งหมด 
        Dim c As Control
        For Each c In Me.Panel3.Controls
            If c.GetType Is GetType(TextBox) Then
                CType(c, TextBox).Clear()
            End If
        Next
    End Sub
    Private Sub ClearTextAll2() '---เคลียร์ข้อมูลทั้งหมด 
        Dim c As Control
        For Each c In Me.Panel4.Controls
            If c.GetType Is GetType(TextBox) Then
                CType(c, TextBox).Clear()
            End If
        Next
    End Sub
    '--ปุ่ม<<Previous
    Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
        _Index -= 1
        Label3.Text = "ภาพที่ : " & _Index + 1
        Picturebox1.Image = Image.FromFile(ListFile(_Index))
        Button2.Enabled = True
        If _Index = 0 Then Button1.Enabled = False
    End Sub
    '--ปุ่ม Next >>
    Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
        _Index += 1
        Label4.Text = "ภาพที่ : " & _Index + 1
        Picturebox1.Image = Image.FromFile(ListFile(_Index))
        Button1.Enabled = True
        If _Index = ListFile.Length - 1 Then Button2.Enabled = False
    End Sub
End Class
 |  
              | 
                
                  |  |  |  |  
                  |  | 
                      
                        | Date :
                            2011-07-13 13:37:24 | By :
                            สายน้ำ.. |  |  |  
                  |  |  |  |  |  |  |  
          |  |  |  |  |  
 
        
          |  |  |  |  |  
          |  |  | 
            
              | ลองเพิ่ม บรรทัดนี้ 
 Code (VB.NET)
 
    _Main = RootDirectory & "\"
 
 หลัง
 
 Code (VB.NET)
 
 RootDirectory = IniFile.GetString("Directory", "Root", "Error File")
 แล้วทดลอง Run ดูครับ
 
 |  
              | 
                
                  |  |  |  |  
                  |  | 
                      
                        | Date :
                            2011-07-13 13:44:36 | By :
                            kaimuk |  |  |  
                  |  |  |  |  |  |  |  
          |  |  |  |  |  
 
 
 
        
          |  |  |  |  |  
          |  |  | 
            
              | Code (VB.NET) 
 _Index = 0
        If Directory.Exists(_Main & DataGridView1.Rows(e.RowIndex).Cells(0).Value) Then
            ListFile = Directory.GetFiles(_Main & DataGridView1.Rows(e.RowIndex).Cells(0).Value, "*.JPG")
            Label1.Text = "จำนวนภาพ : " & ListFile.Length
            Label2.Text = "ภาพที่ : " & _Index + 1
            If ListFile.Length <> 0 Then
                PictureBox1.Image = Image.FromFile(ListFile(_Index))
                Button1.Enabled = False
                Button2.Enabled = IIf(ListFile.Length = 1, False, True)
            Else
                PictureBox1.Image = Nothing
                Button1.Enabled = False
                Button2.Enabled = False
            End If
        Else
            MsgBox("ไม่พบ Folder นี้")
            Exit Sub
        End If
 ใช้อันนี้แทนชุดเดิม (ใน DataGridView1_CellMouseClick) จะทำการตรวจสอบ ว่ามี Directory อยู่หรือไม่
 
 
 button 1 = เดินหน้า
 button 2 = ถอยหลังครับ
 
 |  
              | 
 ประวัติการแก้ไข
 2011-07-13 14:18:51
 
                
                  |  |  |  |  
                  |  | 
                      
                        | Date :
                            2011-07-13 14:15:37 | By :
                            kaimuk |  |  |  
                  |  |  |  |  |  |  |  
          |  |  |  |  |  
 
 
        
          |  |  |  |  |  
          |  |  | 
            
              | คุนไข่หมุนใจดีและใจเย็นมากค่ะ พยายามเข้านะคะ 
 |  
              | 
                
                  |  |  |  |  
                  |  | 
                      
                        | Date :
                            2011-07-13 15:00:09 | By :
                            กวน มึน เอ๋อ |  |  |  
                  |  |  |  |  |  |  |  
          |  |  |  |  |  
 
        
          |  |  |  |  |  
          |  |  | 
            
              | ผมรู้เลยว่า 24 เป็น Idol ของผมแค่ผมอ่านเจอคำที่ 2 (ไข่) โดยไม่ต้องอ่านถึงตัวสุดท้าย (เอ๋อ) เป็นปลื้มจริงๆ 
 จขกท. ครับผมว่า จขกท. ดูเรื่อง  resource ก่อนดีกว่าครับ Code ของ จขกท. หลายจุด ที่ใช้งาน  resource เกินความจำเป็น เช่นการ Load Data เข้า Datatable เข้าบ่อยครั้งทั้งๆ ที่ควรทำแค่ครั้งเดียว และอีกหลายๆ จุดเลยทีเดียว เรื่อง interface ไว้ก่อนดีกว่า เอาไว้ จขกท. มีความเข้าใจเรื่องพื้นฐานก่อนดีกว่าครับ ก่อนไปถึงเรื่องยากขึ้น (Threading เข้าใจยากกว่า String เยอะนะครับ)
 
 
 *** Threading ต้องใช้ถ้าจะทำตามที่ จขกท. ต้องการ
 
 |  
              | 
                
                  |  |  |  |  
                  |  | 
                      
                        | Date :
                            2011-07-13 15:42:05 | By :
                            kaimuk |  |  |  
                  |  |  |  |  |  |  |  
          |  |  |  |  |  
 
        
          |  |  |  |  |  
          |  |  | 
            
              |  ตอบความคิดเห็นที่ : 22 เขียนโดย : kaimuk เมื่อวันที่ 2011-07-13 14:15:37 
 รายละเอียดของการตอบ ::
 พี่คะ..... ขอเพิ่มเติมตรงนี้หน่อยค่ะ 
คือว่า... Root รูปภาพน่ะค่ะ พี่เค้าต้องการเปน Root = /รหัสโซน/รหัสลูกค้า  น่ะค่ะ.. ต้องเพิ่มเติมตรงไหนคะ รหัสโซน คือ ZoneCode รหัสลุกค้าก้คือ กริดวิวเซลแรกเหมือนเดิม
 
อีกนิสนะคะ..  
1.ต้องการให้คลิกที่คอมโบบ๊อคโซนพื้นที่ก้ให้โหลดข้อมูลมาใส่ในกริดวิวเดิมเขียนตอนฟอร์มโหลด  
ซึ่ง มันจะขัดแย้งกับ เหตุการ ComboBox1_SelectedValueChanged จะต้องทำยังไงคะ 
โค๊ตคือ
Code (VB.NET)    Private Sub frmSlideShow_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
        Connstring = "Provider = Microsoft.Jet.OLEDB.4.0;Data Source="
        StrFile = IniFile.GetString("Database", "Server", "Error File")
        Connstring = Connstring & StrFile
        Connstring = Connstring & "Persist Security Info = False"
        Cn = New OleDbConnection(Connstring)
        Cn.Open()
        RootDirectory = IniFile.GetString("Directory", "Root", "Error File")
        _Main = RootDirectory & "\"
        Dim str As String = ""
        str = "SELECT * FROM TBZONE"
        Cm = New OleDbCommand(str, Cn)
        dr = Cm.ExecuteReader
        dr.Read()
        dt = New DataTable
        dt.Load(dr)
        With ComboBox1
            .DisplayMember = "ZoneName" '--ชื่อโซน
            .ValueMember = "ZoneCode" '--รหัสโซน
            .DataSource = dt
        End With
   End Sub
โค๊ตที่เหตุการณ์ ComboBox1_SelectedValueChanged คือ
   Private Sub ComboBox1_SelectedValueChanged(ByVal sender As Object, ByVal e As System.EventArgs) Handles ComboBox1.SelectedValueChanged
   
        Try
            Dim strSearch As String = "SELECT CODE,CODESC,NAME1 from qrycustomer where [Zone] = '" & ComboBox1.SelectedValue & "' "
            Cm = New OleDbCommand(strSearch, Cn)
            dr = Cm.ExecuteReader
            If dr.HasRows Then
                dt = New DataTable
                dt.Load(dr)
                DataGridView1.DataSource = dt
                GridviewList()
            Else
                MessageBox.Show("ไม่พบข้อมูล !!!..  & กรุณาค้นหาใหม่ ", "", MessageBoxButtons.OK, MessageBoxIcon.Warning)
                DataGridView1.DataSource = Nothing
                ClearTextAll()
            End If
        Catch ex As Exception
            MsgBox(ex.Message, MsgBoxStyle.Critical, "Error")
        End Try
    End Sub
ขอความช่วยเหลืออีกหน่อยนะคะ.. ขอบคุนมากๆๆค่ะ^^
 |  
              | 
                
                  |  |  |  |  
                  |  | 
                      
                        | Date :
                            2011-07-21 10:37:03 | By :
                            คนเดิม |  |  |  
                  |  |  |  |  |  |  |  
          |  |  |  |  |  
 
        
          |  |  |  |  |  
          |  |  | 
            
              | รบกวนแนะนำการใช้คำสั่ง เมื่อคลิกไปยังข้อความที่เราต้องการ และให้รูปแสดง ควรเขียนคำสั่งแบบไหนค่ะ 
 |  
              | 
                
                  |  |  |  |  
                  |  | 
                      
                        | Date :
                            2018-03-05 11:09:23 | By :
                            Jimm |  |  |  
                  |  |  |  |  |  |  |  
          |  |  |  |  |  |  |