Click here to Skip to main content
16,004,507 members
Home / Discussions / Visual Basic
   

Visual Basic

 
GeneralRe: Help-Weird Problem with Masked Textbox Pin
Nilesh Hapse7-Jan-08 0:33
Nilesh Hapse7-Jan-08 0:33 
GeneralRe: Help-Weird Problem with Masked Textbox Pin
ChandraRam7-Jan-08 22:24
ChandraRam7-Jan-08 22:24 
General{"Exception from HRESULT: 0x800A5077"} Pin
phoopwint6-Jan-08 17:43
phoopwint6-Jan-08 17:43 
GeneralRe: {"Exception from HRESULT: 0x800A5077"} Pin
TheMandolinMan7-Jan-08 4:30
TheMandolinMan7-Jan-08 4:30 
GeneralRe: {"Exception from HRESULT: 0x800A5077"} Pin
Paul Conrad7-Jan-08 12:51
professionalPaul Conrad7-Jan-08 12:51 
QuestionHow to create My computer treeview in VB.Net Pin
bircut6-Jan-08 17:31
bircut6-Jan-08 17:31 
GeneralSort column 1 and after column 2 Pin
helelark1236-Jan-08 4:04
helelark1236-Jan-08 4:04 
AnswerRe: Sort column 1 and after column 2 Pin
Guffa6-Jan-08 5:12
Guffa6-Jan-08 5:12 
You can't concatenate DataGridViewColumn objects. The Sort method only takes a single DataGridViewColumn object, or a class that implements the IComparer interface.

Here's an example on using IComparer from MSDN Library:

Private Sub Button1_Click(ByVal sender As Object, ByVal e As EventArgs) _
Handles Button1.Click
    If RadioButton1.Checked = True Then
        DataGridView1.Sort(New RowComparer(SortOrder.Ascending))
    ElseIf RadioButton2.Checked = True Then
        DataGridView1.Sort(New RowComparer(SortOrder.Descending))
    End If
End Sub

Private Class RowComparer
    Implements System.Collections.IComparer

    Private sortOrderModifier As Integer = 1

    Public Sub New(ByVal sortOrder As SortOrder)
        If sortOrder = sortOrder.Descending Then
            sortOrderModifier = -1
        ElseIf sortOrder = sortOrder.Ascending Then

            sortOrderModifier = 1
        End If
    End Sub

    Public Function Compare(ByVal x As Object, ByVal y As Object) As Integer _
        Implements System.Collections.IComparer.Compare

        Dim DataGridViewRow1 As DataGridViewRow = CType(x, DataGridViewRow)
        Dim DataGridViewRow2 As DataGridViewRow = CType(y, DataGridViewRow)

        ' Try to sort based on the Last Name column.
        Dim CompareResult As Integer = System.String.Compare( _
            DataGridViewRow1.Cells(1).Value.ToString(), _
            DataGridViewRow2.Cells(1).Value.ToString())

        ' If the Last Names are equal, sort based on the First Name.
        If CompareResult = 0 Then
            CompareResult = System.String.Compare( _
                DataGridViewRow1.Cells(0).Value.ToString(), _
                DataGridViewRow2.Cells(0).Value.ToString())
        End If
        Return CompareResult * sortOrderModifier
    End Function
End Class


Experience is the sum of all the mistakes you have done.

GeneralRe: Sort column 1 and after column 2 Pin
helelark1238-Jan-08 20:53
helelark1238-Jan-08 20:53 
AnswerRe: Sort column 1 and after column 2 Pin
Guffa9-Jan-08 3:49
Guffa9-Jan-08 3:49 
GeneralRe: Sort column 1 and after column 2 Pin
helelark1239-Jan-08 4:04
helelark1239-Jan-08 4:04 
GeneralRe: Sort column 1 and after column 2 Pin
Guffa9-Jan-08 16:04
Guffa9-Jan-08 16:04 
AnswerRe: Sort column 1 and after column 2 Pin
helelark12312-Jan-08 2:57
helelark12312-Jan-08 2:57 
GeneralReading text file Pin
Ahamed Azeem5-Jan-08 21:54
Ahamed Azeem5-Jan-08 21:54 
GeneralRe: Reading text file Pin
Christian Graus5-Jan-08 22:53
protectorChristian Graus5-Jan-08 22:53 
GeneralRetrieve Parts from Item in Arraylist Pin
Dayekh5-Jan-08 19:34
Dayekh5-Jan-08 19:34 
AnswerRe: Retrieve Parts from Item in Arraylist Pin
Reza Raad5-Jan-08 19:56
Reza Raad5-Jan-08 19:56 
GeneralRe: Retrieve Parts from Item in Arraylist Pin
Dayekh6-Jan-08 12:05
Dayekh6-Jan-08 12:05 
GeneralProgram Files Nightmare Pin
Dreamer20075-Jan-08 1:43
Dreamer20075-Jan-08 1:43 
GeneralRe: Program Files Nightmare Pin
nlarson115-Jan-08 3:45
nlarson115-Jan-08 3:45 
GeneralRe: Program Files Nightmare Pin
Dave Kreskowiak5-Jan-08 15:14
mveDave Kreskowiak5-Jan-08 15:14 
GeneralRe: Program Files Nightmare Pin
Dreamer20076-Jan-08 19:32
Dreamer20076-Jan-08 19:32 
GeneralRe: Program Files Nightmare Pin
Dave Kreskowiak7-Jan-08 3:01
mveDave Kreskowiak7-Jan-08 3:01 
QuestionWhen do and where do i decide i need to adopt threading if at all ??? Pin
vbbeg4-Jan-08 20:37
vbbeg4-Jan-08 20:37 
AnswerRe: When do and where do i decide i need to adopt threading if at all ??? Pin
Guffa5-Jan-08 7:32
Guffa5-Jan-08 7:32 

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.