تقييم الموضوع :
  • 0 أصوات - بمعدل 0
  • 1
  • 2
  • 3
  • 4
  • 5
[سؤال] البحث بالداتاجريدفيو
#3
كود :
ublic Class riport1

   Private Sub riport1_Load(sender As Object, e As EventArgs) Handles MyBase.Load
       If My.Settings.TPY = "M" Then

           Load_send()
           FormatDGV_send(DGV_send)
           DGV_send.Sort(DGV_send.Columns(0), System.ComponentModel.ListSortDirection.Ascending)
           Load_NOTE4()
           color_note1()
           color_note3()
           color_note2()
       Else
           If My.Settings.TPY = "E" Then

               Load_send()
               FormatDGV_send(DGV_send)
               edatToolStripMenuItem.Enabled = False
               DGV_send.Sort(DGV_send.Columns(0), System.ComponentModel.ListSortDirection.Ascending)

               Load_NOTE4()
               color_note1()
               color_note3()
               color_note2()
           End If
       End If
   End Sub

   Public DT_send As New DataTable
   Public Sub Load_send()
       DGV_send.DataSource = Nothing
       DGV_send.Rows.Clear()
       DT_send.Clear()
       Dim Da As New SqlDataAdapter("Select id,date1,from_b,to_b,note_m,note1,note2,note3  From send ", Con) '
       Try
           If Con.State = 1 Then Con.Close()
           Con.Open()
           Da.Fill(DT_send)
           Con.Close()
           Da = Nothing
       Catch ex As Exception
           MessageBox.Show(ex.Message)
           Con.Close()
       End Try
       If DT_send.Rows.Count <> 0 Then
           With DGV_send
               .DataSource = DT_send

               'Form1.BindingContext(DT_send).Position = Form1.BindingContext(DT_send).Count - 1
           End With
       End If
   End Sub
 

   Private Sub Load_note1()

       For i As Integer = 0 To DGV_send.Rows.Count - 2 Step +1
           If DGV_send.Rows(i).Cells(5).Value = "1" Then
               DGV_send.Rows(i).Cells(5).Value = "تم الارسال"

           End If
       Next
   End Sub
   Private Sub Load_note2()
       For i As Integer = 0 To DGV_send.Rows.Count - 2 Step +1
           If DGV_send.Rows(i).Cells(6).Value = "0" Then
               DGV_send.Rows(i).Cells(6).Value = "قيد التسليم"
           Else
               If DGV_send.Rows(i).Cells(6).Value = "1" Then
                   DGV_send.Rows(i).Cells(6).Value = "تم التسليم"
               End If
           End If
       Next
   End Sub
   Private Sub Load_note3()
       For i As Integer = 0 To DGV_send.Rows.Count - 2 Step +1
           If DGV_send.Rows(i).Cells(7).Value = "0" Then
               DGV_send.Rows(i).Cells(7).Value = "قيد التاكيد"
           Else
               If DGV_send.Rows(i).Cells(7).Value = "1" Then
                   DGV_send.Rows(i).Cells(7).Value = "تم التاكيد"
               End If
           End If
       Next
   End Sub
   Private Sub Load_branch1()
       For i As Integer = 0 To DGV_send.Rows.Count - 2 Step +1
           If DGV_send.Rows(i).Cells(3).Value = "01" Then
               DGV_send.Rows(i).Cells(3).Value = "فرع التحليه"
           Else
               If DGV_send.Rows(i).Cells(3).Value = "02" Then
                   DGV_send.Rows(i).Cells(3).Value = "فرع العليا"
               Else
                   If DGV_send.Rows(i).Cells(3).Value = "03" Then
                       DGV_send.Rows(i).Cells(3).Value = "الادارة"
                   End If
                   End If
           End If
       Next
   End Sub

   Private Sub Load_branch2()
       For i As Integer = 0 To DGV_send.Rows.Count - 2 Step +1
           If DGV_send.Rows(i).Cells(2).Value = "01" Then
               DGV_send.Rows(i).Cells(2).Value = "فرع التحليه"
           Else
               If DGV_send.Rows(i).Cells(2).Value = "02" Then
                   DGV_send.Rows(i).Cells(2).Value = "فرع العليا"
               Else
                   If DGV_send.Rows(i).Cells(3).Value = "03" Then
                       DGV_send.Rows(i).Cells(3).Value = "الادارة"
                   End If
               End If
           End If
       Next
   End Sub
 

 
   Public Sub Load_NOTE4()
       Load_note1()
       Load_note2()
       Load_note3()
       Load_branch1()
       Load_branch2()
   End Sub
   Private Sub edatToolStripMenuItem_Click(sender As Object, e As EventArgs) Handles edatToolStripMenuItem.Click
       Dim i As Integer

       edatcon.Show()

       i = DGV_send.SelectedCells(0).RowIndex



       edatcon.TextBox1.Text = DGV_send.Rows(i).Cells(0).Value.ToString()
       edatcon.DateTimePicker1.Text = DGV_send.Rows(i).Cells(1).Value.ToString()
       edatcon.ComboBox1.Text = DGV_send.Rows(i).Cells(2).Value.ToString()
       edatcon.ComboBox2.Text = DGV_send.Rows(i).Cells(3).Value.ToString()
       edatcon.TextBox3.Text = DGV_send.Rows(i).Cells(4).Value.ToString()
       edatcon.TextBox9.Text = DGV_send.Rows(i).Cells(5).Value.ToString()
       edatcon.TextBox10.Text = DGV_send.Rows(i).Cells(6).Value.ToString()
       edatcon.TextBox11.Text = DGV_send.Rows(i).Cells(7).Value.ToString()
       edatcon.Load_sand_iteme()
       edatcon.renameresize()
   End Sub

 
   Public Sub color_note1()
       For i As Integer = 0 To Me.DGV_send.Rows.Count - 1
           If Me.DGV_send.Rows(i).Cells("note1").Value = "تم الارسال" Then
               Me.DGV_send.Rows(i).Cells("note1").Style.BackColor = Color.LimeGreen


           End If
       Next
   End Sub
   Public Sub color_note2()
       For i As Integer = 0 To Me.DGV_send.Rows.Count - 1

           If Me.DGV_send.Rows(i).Cells("note2").Value = "قيد التسليم" Then
               Me.DGV_send.Rows(i).Cells("note2").Style.BackColor = Color.Red
           ElseIf Me.DGV_send.Rows(i).Cells("note2").Value = "تم التسليم" Then
               Me.DGV_send.Rows(i).Cells("note2").Style.BackColor = Color.LimeGreen
           End If
       Next
   End Sub
   Public Sub color_note3()
       For i As Integer = 0 To Me.DGV_send.Rows.Count - 1
           If Me.DGV_send.Rows(i).Cells("note3").Value = "قيد التاكيد" Then
               Me.DGV_send.Rows(i).Cells("note3").Style.BackColor = Color.Red
           ElseIf Me.DGV_send.Rows(i).Cells("note3").Value = "تم التاكيد" Then
               Me.DGV_send.Rows(i).Cells("note3").Style.BackColor = Color.LimeGreen
           End If
       Next
   End Sub
   Private Sub DGV_send_ColumnAdded(sender As Object, e As DataGridViewColumnEventArgs) Handles DGV_send.ColumnAdded
       e.Column.SortMode = DataGridViewColumnSortMode.NotSortable
   End Sub
   Private Sub Search_send()

       Dim cmd As New SqlClient.SqlCommand
       Dim DR_send As SqlClient.SqlDataReader
       Dim DTS_send As New DataTable
       Dim MySqlSreach As String
       MySqlSreach = "Select id,date1,from_b,to_b,note_m,note1,note2,note3 From send Where id = " & Txtid.Text & ""
       Try
           If con.State = ConnectionState.Open Then con.Close()
           con.Open()
           Cmd.Connection = Con
           Cmd.CommandType = Data.CommandType.Text
           Cmd.CommandText = MySqlSreach
           DTS_send.Load(Cmd.ExecuteReader)
           DR_send = Cmd.ExecuteReader
           DR_send.Read()
           If DR_send.HasRows Then

               Me.Txtid.Text = DR_send("id").ToString
               'Me.Dtpdate1.Value = DR_send("date1").ToString
               'Me.Txtfrom_b.Text = DR_send("from_b").ToString
               'Me.Txtto_b.Text = DR_send("to_b").ToString
               'Me.Txtnote_m.Text = DR_send("note_m").ToString
               'Me.Txtnote1.Text = DR_send("note1").ToString
               'Me.Txtnote2.Text = DR_send("note2").ToString
               'Me.Txtnote3.Text = DR_send("note3").ToString

               DGV_send.DataSource = DTS_send
               DR_send.Close()
           Else
               DR_send.Close()
               'ClearText()
               DGV_send.DataSource = Nothing
               DGV_send.Rows.Clear()
               MsgBox(" عفواً . لا يوجد بيانات ", MsgBoxStyle.Information)
           End If
       Catch ex As Exception
           MessageBox.Show(ex.Message)
           Con.Close()
       End Try
   End Sub



 
 
   Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
       If Txtid.Text = "" Then
           MsgBox("ادخل رقم الحركة")
           Txtid.Focus()
       Else
           Search_send()
           Load_NOTE4()
           FormatDGV_send(DGV_send)

           color_note1()
           color_note3()
           color_note2()
       End If
   End Sub
End Class
الرد }}}
تم الشكر بواسطة:


الردود في هذا الموضوع
البحث بالداتاجريدفيو - بواسطة allo5_800 - 20-12-18, 03:26 AM
RE: البحث بالداتاجريدفيو - بواسطة elgokr - 20-12-18, 03:44 AM
RE: البحث بالداتاجريدفيو - بواسطة allo5_800 - 20-12-18, 04:21 AM
RE: البحث بالداتاجريدفيو - بواسطة elgokr - 20-12-18, 03:44 PM
RE: البحث بالداتاجريدفيو - بواسطة allo5_800 - 24-12-18, 09:32 AM

المواضيع المحتمل أن تكون متشابهة .
الموضوع : الكاتب الردود : المشاهدات : آخر رد
  [VB.NET] استفسار بخصوص البحث في RichTextBox SerialPort dubai.eig 2 665 18-06-25, 11:09 AM
آخر رد: dubai.eig
Rainbow [كود] البحث تلقائياً عند التبديل بين الـ RadioButton محمد مسافر 8 710 04-10-24, 02:33 AM
آخر رد: Taha Okla
Rainbow [كود] البحث وتحريك اسهم الداتا جريدفيو عند البحث محمد مسافر 2 587 19-09-24, 01:14 AM
آخر رد: محمد مسافر
  مساعدة البحث بين تاريخين أبووسم 3 550 16-08-24, 01:37 PM
آخر رد: أبووسم
  البحث بالأسم الأول فقط heem1986 6 643 03-08-24, 04:17 PM
آخر رد: heem1986
  [VB.NET] تجاهل التشكيل من الأسماء عند البحث في التيكست بوكس Khalil chiha 3 535 01-08-24, 10:28 PM
آخر رد: Khalil chiha
  يوجد خطاء فى كود البحث بواستطة الكمبوبوكس واجراء مخزن new_programer 4 413 06-07-24, 12:05 AM
آخر رد: Zuhare
  البحث بين تاريخين مع الوقت - من بداية اليوم - حتى اخر اليوم moh61 3 610 12-06-24, 08:00 PM
آخر رد: Taha Okla
  أريد البحث بإستخدام أي جزء من الكلمة و ليس أول جزء منها . CoderMM 3 619 17-04-24, 01:19 AM
آخر رد: Taha Okla
  [VB.NET] البحث باستخدام CheckedListBox لتكون نتيجة التحديد شرط لجملة الاستعلام ahmedramzyaish 0 445 19-02-24, 03:44 AM
آخر رد: ahmedramzyaish

التنقل السريع :


يقوم بقرائة الموضوع: بالاضافة الى ( 1 ) ضيف كريم