Click here to Skip to main content
15,927,055 members
Home / Discussions / Visual Basic
   

Visual Basic

 
GeneralRe: User Activity log in Windows Application Pin
vilunjike manda12-Jun-06 4:34
vilunjike manda12-Jun-06 4:34 
GeneralRe: User Activity log in Windows Application Pin
Dave Kreskowiak12-Jun-06 8:32
mveDave Kreskowiak12-Jun-06 8:32 
AnswerRe: User Activity log in Windows Application Pin
Mekong River12-Jun-06 15:45
Mekong River12-Jun-06 15:45 
Questionusing DataSet Pin
iramg11-Jun-06 21:35
iramg11-Jun-06 21:35 
Questionerror: 13queryinterface for interface DTS.customtask failed Pin
bita_engr11-Jun-06 21:04
bita_engr11-Jun-06 21:04 
AnswerRe: error: 13queryinterface for interface DTS.customtask failed Pin
Mekong River11-Jun-06 21:28
Mekong River11-Jun-06 21:28 
Questionin vb sorting 2d array based on second column (urgent one plz) Pin
peter rankel11-Jun-06 0:44
peter rankel11-Jun-06 0:44 
AnswerRe: in vb sorting 2d array based on second column (urgent one plz) Pin
progload11-Jun-06 13:06
progload11-Jun-06 13:06 
Something like this:

Private Sub Sort2DArray(ByVal TwoD_Arr(,) As Double)
    '
    Dim Tmp_Arr(0, 1) As Double
    Dim upperInd As Integer
    Dim lowerInd As Integer
    '
    For upperInd = 0 To TwoD_Arr.GetLength(0) - 1
        '
        For lowerInd = (upperInd + 1) To TwoD_Arr.GetLength(0) - 1
            '
            If (TwoD_Arr(lowerInd, 0) > TwoD_Arr(upperInd, 0)) Then
                '
                Tmp_Arr(0, 0) = TwoD_Arr(lowerInd, 0)
                Tmp_Arr(0, 1) = TwoD_Arr(lowerInd, 1)
                '
                TwoD_Arr(lowerInd, 0) = TwoD_Arr(upperInd, 0)
                TwoD_Arr(lowerInd, 1) = TwoD_Arr(upperInd, 1)
                '
                TwoD_Arr(upperInd, 0) = Tmp_Arr(0, 0)
                TwoD_Arr(upperInd, 1) = Tmp_Arr(0, 1)
            End If
            '
        Next
        '
    Next
    '
End Sub

Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click

    Dim TwoD_Arr(,) As Double = {{5, 1}, {6, 2}, {3, 3}, {8, 4}, {2, 5}}

    Dim i As Integer
    Dim j As Integer

    For i = 0 To TwoD_Arr.GetLength(0) - 1
        Debug.WriteLine("UnSorted: " & TwoD_Arr(i, 0) & " " & TwoD_Arr(i, 1))
    Next

    Sort2DArray(TwoD_Arr)

    For j = 0 To TwoD_Arr.GetLength(0) - 1
        Debug.WriteLine("Sorted: " & TwoD_Arr(j, 0) & " " & TwoD_Arr(j, 1))
    Next

End Sub


Returns:

UnSorted: 5 1
UnSorted: 6 2
UnSorted: 3 3
UnSorted: 8 4
UnSorted: 2 5

Sorted: 8 4
Sorted: 6 2
Sorted: 5 1
Sorted: 3 3
Sorted: 2 5

Hope that helps,

progload
QuestionDrag and Drop image Pin
furjaw10-Jun-06 16:42
furjaw10-Jun-06 16:42 
AnswerRe: Drag and Drop image Pin
Mekong River11-Jun-06 21:31
Mekong River11-Jun-06 21:31 
GeneralRe: Drag and Drop image Pin
furjaw6-Jul-06 18:53
furjaw6-Jul-06 18:53 
QuestionWord documents reader Pin
noRTH121210-Jun-06 6:40
noRTH121210-Jun-06 6:40 
AnswerRe: Word documents reader Pin
Mekong River11-Jun-06 21:33
Mekong River11-Jun-06 21:33 
QuestionUpdating the WebBrowser document Pin
grantg10-Jun-06 4:47
grantg10-Jun-06 4:47 
Questionremainder in vb.net1.1 Pin
amaneet9-Jun-06 22:56
amaneet9-Jun-06 22:56 
AnswerRe: remainder in vb.net1.1 Pin
Guffa9-Jun-06 23:24
Guffa9-Jun-06 23:24 
QuestionOpen/Save word documen in the server Pin
Member 22716559-Jun-06 22:09
Member 22716559-Jun-06 22:09 
AnswerRe: Open/Save word documen in the server Pin
Dave Kreskowiak10-Jun-06 2:53
mveDave Kreskowiak10-Jun-06 2:53 
AnswerRe: Open/Save word documen in the server Pin
Mekong River11-Jun-06 21:35
Mekong River11-Jun-06 21:35 
QuestionTCP/IP server Pin
awperli9-Jun-06 11:26
awperli9-Jun-06 11:26 
AnswerRe: TCP/IP server Pin
Joshua Quick9-Jun-06 12:55
Joshua Quick9-Jun-06 12:55 
Questionrun application from the network drive Pin
dphound9-Jun-06 10:17
dphound9-Jun-06 10:17 
AnswerRe: run application from the network drive Pin
Joshua Quick9-Jun-06 12:51
Joshua Quick9-Jun-06 12:51 
Questionhow to connect DSN server Pin
iramg9-Jun-06 10:06
iramg9-Jun-06 10:06 
AnswerRe: how to connect DSN server Pin
Joshua Quick9-Jun-06 13:09
Joshua Quick9-Jun-06 13:09 

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.