Click here to Skip to main content
14,575,464 members

.NET (Core and Framework)

 
GeneralRe: Looking for a (free) .NET pluralizer / singularizer Pin
Sander Rossel3-Jun-20 4:48
professionalSander Rossel3-Jun-20 4:48 
GeneralRe: Looking for a (free) .NET pluralizer / singularizer Pin
pkfox13-Jun-20 5:30
professionalpkfox13-Jun-20 5:30 
GeneralRe: Looking for a (free) .NET pluralizer / singularizer Pin
Sander Rossel13-Jun-20 23:53
professionalSander Rossel13-Jun-20 23:53 
Questionport 5xxxx is already in use, unable to connect to web server IIS Express Pin
Member 109358009-May-20 3:35
MemberMember 109358009-May-20 3:35 
AnswerRe: port 5xxxx is already in use, unable to connect to web server IIS Express Pin
Member 79891223-Jun-20 5:39
MemberMember 79891223-Jun-20 5:39 
QuestionDiscUtils.dll And DiscUtils.Common.Dll (i can't find them) Pin
Member 147711169-May-20 3:32
MemberMember 147711169-May-20 3:32 
AnswerRe: DiscUtils.dll And DiscUtils.Common.Dll (i can't find them) Pin
Dave Kreskowiak9-May-20 4:06
mveDave Kreskowiak9-May-20 4:06 
Questiondifficulties with AdvancedDatagridView Pin
Member 147338666-May-20 22:44
MemberMember 147338666-May-20 22:44 
i have already a good Programm which shows my database in a Datagridview,

everything is Ok with it, now i would like to add Filter Option to my Datagridview like Excel Filter

i used : AdvanceDatagridview it's an advanced Datagridview with a lot of filter Option,

the problem here, i can not use this datagridview unless i bind it with a Datatable and i also when i did that t found a big problem because in my old code there is Datagridviewrow

and now so i tried to convert Datagridviewrow to datarow to import it in datatable and to use it but it did not work

my Old Code :

<pre> sSQL = "SELECT " &
                                        "ItemID, " &
                                        "PSC_tdItems.OrderID, " &
                                        "ArtikelID, " &
                                        "Menge, " &
                                        "Art, "
                                        "CodeID, " &

 MyCommand = New SqlCommand(sSQL, conFF)

      drW2P = MyCommand.ExecuteReader
      If drW2P.HasRows Then
        While drW2P.Read()
          nField_ItemID = 0
          nField_OrderID = 0              
          nField_Quantity = 0.0
          sField_Art = ""
          sField_pscArticleID = ""
          sField_CodeID = ""


If Not DBNull.Value.Equals(drW2P("ItemID")) Then
            nField_ItemID = Convert.ToInt32(drW2P("ItemID"))
          End If
If Not DBNull.Value.Equals(drW2P("OrderID")) Then
            nField_OrderID = Convert.ToInt32(drW2P("OrderID"))
          End If
If Not DBNull.Value.Equals(drW2P("Menge")) Then
            nField_Quantity = Convert.ToDouble(drW2P("Menge").ToString.Replace(".", ""))
          End If
If Not DBNull.Value.Equals(drW2P("Art")) Then
            sField_Art = drW2P("Art").ToString
          End If
If Not DBNull.Value.Equals(drW2P("ArticelNumber")) Then
        sField_mspArticleNumber = drW2P("ArticelNumber").ToString
      End If
If Not DBNull.Value.Equals(drW2P("CodeID")) Then
        sField_CodeID = drW2P("CodeID").ToString
      End If 
Try
            MyRow = New DataGridViewRow
            MyRow.CreateCells(dgvW2P)
            MyRow.SetValues("0",
                                                    imgNotOK.ToBitmap,
                                                    nField_ItemID,
                                                    nField_OrderID,
                                                    nField_Quantity
                                                    sField_Art,
                                                    sField_pscArticleID
                                                    sField_CodeID)
 dgvW2P.Rows.Add(MyRow)
          Catch ex As Exception
            ErrorLogging(True, "Sub FillW2PGrid: Add a line in the grid" & vbCrLf & ex.Message & vbCrLf & "SQL:" & sSQL & vbCrLf & ex.StackTrace.ToString, nErrorLevel_Error)
          Finally
            If Not MyRow Is Nothing Then
              MyRow.Dispose()
              MyRow = Nothing
            End If
          End Try
     End While
      End If

my new Code :


<pre>   sSQL = "SELECT " &
                                        "ItemID, " &
                                        "PSC_tdItems.OrderID, " &
                                        "ArtikelID, " &
                                        "Menge, " &
                                        "Art, "
                                        "CodeID, " &

 ' here are my new modification


Dim Dt As New DataTable
  Dt.Clear()
  Dim cmd As New SqlCommand

  If conFF.State = ConnectionState.Open Then
    conFF.Close()
  End If

  conFF.Open()
  cmd.Connection = conMspFF
  cmd.CommandType = CommandType.Text
  cmd.CommandText = (sSQL)

  Dim da As New SqlDataAdapter(cmd)
  da.Fill(Dt)

  bindingSource_data.DataSource = Dt
  dgvW2PNEW.DataSource = bindingSource_data
  dgvW2PNEW.Refresh()

      drW2PNEW = MyCommand.ExecuteReader


' the problem is here : i can not use HasRow with my new Datagridview

<pre> If drW2PNEW.HasRows Then
            While drW2PNEW.Read()
              nField_ItemID = 0
              nField_OrderID = 0              
              nField_Quantity = 0.0
              sField_Art = ""
              sField_pscArticleID = ""
              sField_CodeID = ""


    If Not DBNull.Value.Equals(drW2PNEW("ItemID")) Then
                nField_ItemID = Convert.ToInt32(drW2PNEW("ItemID"))
              End If
    If Not DBNull.Value.Equals(drW2PNEW("OrderID")) Then
                nField_OrderID = Convert.ToInt32(drW2PNEW("OrderID"))
              End If
    If Not DBNull.Value.Equals(drW2PNEW("Menge")) Then
                nField_Quantity = Convert.ToDouble(drW2PNEW("Menge").ToString.Replace(".", ""))
              End If
    If Not DBNull.Value.Equals(drW2PNEW("Art")) Then
                sField_Art = drW2PNEW("Art").ToString
              End If
    If Not DBNull.Value.Equals(drW2PNEW("ArticelNumber")) Then
            sField_mspArticleNumber = drW2PNEW("ArticelNumber").ToString
          End If
    If Not DBNull.Value.Equals(drW2PNEW("CodeID")) Then
            sField_CodeID = drW2PNEW("CodeID").ToString
          End If 
    Try
                MyRow = New DataGridViewRow
                MyRow.CreateCells(dgvW2PNEW)
                MyRow.SetValues("0",
                                                        imgNotOK.ToBitmap,
                                                        nField_ItemID,
                                                        nField_OrderID,
                                                        nField_Quantity
                                                        sField_Art,
                                                        sField_pscArticleID
                                                        sField_CodeID)
' here i get the error
 dgvW2PNEW.Rows.Add(MyRow)
              Catch ex As Exception
                ErrorLogging(True, "Sub FillW2PGrid: Add a line in the grid" & vbCrLf & ex.Message & vbCrLf & "SQL:" & sSQL & vbCrLf & ex.StackTrace.ToString, nErrorLevel_Error)
              Finally
                If Not MyRow Is Nothing Then
                  MyRow.Dispose()
                  MyRow = Nothing
                End If
              End Try
         End While
          End If

AnswerRe: difficulties with AdvancedDatagridView Pin
Richard MacCutchan6-May-20 23:00
mveRichard MacCutchan6-May-20 23:00 
GeneralRe: difficulties with AdvancedDatagridView Pin
Member 147338666-May-20 23:37
MemberMember 147338666-May-20 23:37 
GeneralRe: difficulties with AdvancedDatagridView Pin
Richard MacCutchan7-May-20 0:02
mveRichard MacCutchan7-May-20 0:02 
GeneralRe: difficulties with AdvancedDatagridView Pin
Member 147338667-May-20 0:14
MemberMember 147338667-May-20 0:14 
GeneralRe: difficulties with AdvancedDatagridView Pin
Eddy Vluggen7-May-20 1:05
professionalEddy Vluggen7-May-20 1:05 
GeneralRe: difficulties with AdvancedDatagridView Pin
Member 147338667-May-20 1:46
MemberMember 147338667-May-20 1:46 
GeneralRe: difficulties with AdvancedDatagridView Pin
Pete O'Hanlon7-May-20 1:49
subeditorPete O'Hanlon7-May-20 1:49 
QuestionWindows 1903 Jump Lists Pin
Robert Heath29-Apr-20 19:25
MemberRobert Heath29-Apr-20 19:25 
GeneralRe: Windows 1903 Jump Lists Pin
Richard MacCutchan29-Apr-20 23:10
mveRichard MacCutchan29-Apr-20 23:10 
AnswerRe: Windows 1903 Jump Lists Pin
Eddy Vluggen29-Apr-20 23:29
professionalEddy Vluggen29-Apr-20 23:29 
Questionhow to use datatable as Datasource with Datagridview unless datagridviewrow Pin
Member 1473386629-Apr-20 2:31
MemberMember 1473386629-Apr-20 2:31 
AnswerRe: how to use datatable as Datasource with Datagridview unless datagridviewrow Pin
Richard MacCutchan29-Apr-20 3:20
mveRichard MacCutchan29-Apr-20 3:20 
QuestionThere is no Unicode byte order mark. Cannot switch to Unicode. Pin
Michele Smith20-Apr-20 12:56
MemberMichele Smith20-Apr-20 12:56 
AnswerRe: There is no Unicode byte order mark. Cannot switch to Unicode. Pin
Richard Deeming21-Apr-20 0:21
mveRichard Deeming21-Apr-20 0:21 
QuestionResource Error Pin
Member 129880739-Apr-20 18:19
MemberMember 129880739-Apr-20 18:19 
QuestionRe: Resource Error Pin
Richard MacCutchan9-Apr-20 21:37
mveRichard MacCutchan9-Apr-20 21:37 
AnswerRe: Resource Error Pin
Dave Kreskowiak10-Apr-20 6:40
mveDave Kreskowiak10-Apr-20 6:40 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.