vb@rchiv
VB Classic
VB.NET
ADO.NET
VBA
C#
Zippen wie die Profis!  
 vb@rchiv Quick-Search: Suche startenErweiterte Suche starten   Impressum  | Datenschutz  | vb@rchiv CD Vol.6  | Shop Copyright ©2000-2024
 
zurück

 Sie sind aktuell nicht angemeldet.Funktionen: Einloggen  |  Neu registrieren  |  Suchen

VB.NET - Ein- und Umsteiger
Re: Bestehende ComboBox in DataGridView befüllen 
Autor: stefanbla80
Datum: 02.10.20 08:16

Guten Morgen zusammen,

Beim Laden meines "FollowUp-Formulares" rufe ich die Funktion "FollowUp" auf.

Private Sub Form_FollowUp_Load(ByVal sender As System.Object, ByVal e As _
  System.EventArgs) Handles MyBase.Load
        FollowUp()
        Me.BringToFront()
 
        Dim cmbColumn As DataGridViewComboBoxColumn = _
          DataGridView_FollowUp.Columns(11)
        With cmbColumn
            .Items.Add("Stefan")
        End With
    End Sub
    Private Sub FollowUp()
        Dim myDate1 As Date = Format$(Me.DateTimePicker_StartDate.Value, _
          "yyyy-MM-dd")
        Dim myDate2 As Date = Format$(Me.DateTimePicker_EndDate.Value.AddDays( _
        0), "yyyy-MM-dd")
 
        Me.DataGridView_FollowUp.Rows.Clear()
        Me.DataGridView_FollowUp.AllowUserToAddRows = True
 
        For i = 0 To _
          Form_PlanningGuide.PlanningGuideDataDataGridView.Rows.Count - 1
            If Form_PlanningGuide.PlanningGuideDataDataGridView.Rows(i).Cells( _
            GetColumnNo("Date FollowUp")).Value IsNot DBNull.Value Then
                If Form_PlanningGuide.PlanningGuideDataDataGridView.Rows( _
                i).Cells(GetColumnNo("Date FollowUp")).Value <> "" Then
                    If Form_PlanningGuide.PlanningGuideDataDataGridView.Rows( _
                    i).Cells(GetColumnNo("Date FollowUp")).Value >= myDate1 And _
                        Form_PlanningGuide.PlanningGuideDataDataGridView.Rows( _
                        i).Cells(GetColumnNo("Date FollowUp")).Value <= myDate2 _
                        Then
                        Dim RowCount As Integer = _
                        DataGridView_FollowUp.RowCount - 1
                        DataGridView_FollowUp.Rows.Add()
                        DataGridView_FollowUp.BeginEdit(CBool(RowCount))
                        DataGridView_FollowUp.Rows(RowCount).Cells(0).Value = _
                          Form_PlanningGuide.PlanningGuideDataDataGridView.Rows( _
                          i).Cells(GetColumnNo("ID")).Value.ToString()
                        DataGridView_FollowUp.Rows(RowCount).Cells(1).Value = _
                        Form_PlanningGuide.PlanningGuideDataDataGridView.Rows( _
                        i).Cells(GetColumnNo("Country")).Value.ToString()
                        DataGridView_FollowUp.Rows(RowCount).Cells(2).Value = _
                        Form_PlanningGuide.PlanningGuideDataDataGridView.Rows( _
                        i).Cells(GetColumnNo("Contact comp." & _
                        "name")).Value.ToString()
                        DataGridView_FollowUp.Rows(RowCount).Cells(3).Value = _
                        Form_PlanningGuide.PlanningGuideDataDataGridView.Rows( _
                        i).Cells(GetColumnNo("Customer")).Value.ToString()
                        DataGridView_FollowUp.Rows(RowCount).Cells(4).Value = _
                        Form_PlanningGuide.PlanningGuideDataDataGridView.Rows( _
                        i).Cells(GetColumnNo("Land")).Value.ToString()
                        DataGridView_FollowUp.Rows(RowCount).Cells(5).Value = _
                        Form_PlanningGuide.PlanningGuideDataDataGridView.Rows( _
                        i).Cells(GetColumnNo("Project")).Value.ToString()
                        DataGridView_FollowUp.Rows(RowCount).Cells(6).Value = _
                        Form_PlanningGuide.PlanningGuideDataDataGridView.Rows( _
                        i).Cells(GetColumnNo("Version")).Value.ToString()
                        DataGridView_FollowUp.Rows(RowCount).Cells(7).Value = _
                        Form_PlanningGuide.PlanningGuideDataDataGridView.Rows( _
                        i).Cells(GetColumnNo("Description")).Value.ToString()
                        DataGridView_FollowUp.Rows(RowCount).Cells(8).Value = _
                        Form_PlanningGuide.PlanningGuideDataDataGridView.Rows( _
                        i).Cells(GetColumnNo("Inquiry")).Value.ToString()
                        DataGridView_FollowUp.Rows(RowCount).Cells(9).Value = _
                        Form_PlanningGuide.PlanningGuideDataDataGridView.Rows( _
                        i).Cells(GetColumnNo("Quotation")).Value.ToString()
                        DataGridView_FollowUp.Rows(RowCount).Cells(10).Value = _
                        Form_PlanningGuide.PlanningGuideDataDataGridView.Rows( _
                        i).Cells(GetColumnNo("Date FollowUp")).Value.ToString()
                        DataGridView_FollowUp.Rows(RowCount).Cells(11).Value = _
                        Form_PlanningGuide.PlanningGuideDataDataGridView.Rows( _
                        i).Cells(GetColumnNo("PM")).Value.ToString()
                        DataGridView_FollowUp.Rows(RowCount).Cells(12).Value = _
                        Form_PlanningGuide.PlanningGuideDataDataGridView.Rows( _
                        i).Cells(GetColumnNo("Order")).Value.ToString()
                    End If
                End If
            End If
        Next
 
        Me.DataGridView_FollowUp.Update()
        Me.DataGridView_FollowUp.EndEdit()
        Me.DataGridView_FollowUp.AllowUserToAddRows = False
    End Sub
Hiermit fülle ich dann mein zweites DataGridView - was lediglich als Ansicht dient und den selben/gewohnten Style hat wie meine Haupttabelle.
In den Eigenschaften von DataGridView_FollowUp habe ich Column12 auf Combobox-Spalte definiert.
Evtl. kommt auch das Füllen der Combobox-Spalten mit Items zu früh/spät …?

Grüße
Stefan
alle Nachrichten anzeigenGesamtübersicht  |  Zum Thema  |  Suchen

 ThemaViews  AutorDatum
Bestehende ComboBox in DataGridView befüllen2.145stefanbla8030.09.20 16:18
Re: Bestehende ComboBox in DataGridView befüllen825effeff01.10.20 15:07
Re: Bestehende ComboBox in DataGridView befüllen792stefanbla8001.10.20 15:41
Re: Bestehende ComboBox in DataGridView befüllen798effeff01.10.20 18:43
Re: Bestehende ComboBox in DataGridView befüllen795stefanbla8001.10.20 20:33
Re: Bestehende ComboBox in DataGridView befüllen732effeff01.10.20 21:39
Re: Bestehende ComboBox in DataGridView befüllen732stefanbla8002.10.20 08:16
Re: Bestehende ComboBox in DataGridView befüllen723effeff03.10.20 11:15
Re: Bestehende ComboBox in DataGridView befüllen714stefanbla8003.10.20 12:09
Re: Bestehende ComboBox in DataGridView befüllen716effeff03.10.20 12:33

Sie sind nicht angemeldet!
Um auf diesen Beitrag zu antworten oder neue Beiträge schreiben zu können, müssen Sie sich zunächst anmelden.

Einloggen  |  Neu registrieren

Funktionen:  Zum Thema  |  GesamtübersichtSuchen 

nach obenzurück
 
   

Copyright ©2000-2024 vb@rchiv Dieter Otter
Alle Rechte vorbehalten.
Microsoft, Windows und Visual Basic sind entweder eingetragene Marken oder Marken der Microsoft Corporation in den USA und/oder anderen Ländern. Weitere auf dieser Homepage aufgeführten Produkt- und Firmennamen können geschützte Marken ihrer jeweiligen Inhaber sein.

Diese Seiten wurden optimiert für eine Bildschirmauflösung von mind. 1280x1024 Pixel