borderAndreaVB free resources for Visual Basic developersborder

borderAndreaVB Visual Basic and VB.NET source code resources - Copyright © 1999-2007 Andrea Tincaniborder

AndreaVB | Forum | News | Downloads | Register | Help | Member List | Statistics | Search | PM | Profile

Print This Topic
Previous Topic (Buttons on VB.Net 2005)Next Topic (Followup: Add data in VB .Net) New Topic New Poll Post Reply
AndreaVB Forum : VB.Net : please guys help me out
Poster Message
pinon
Level: Trainee

Registered: 05-07-2006
Posts: 1

icon please guys help me out

hello im trying to make sorting numbers, i have 4 buttons

and 2 textboxes and one listview the first button is for sort

ascending , second is descinding, third is odd, fourth is add

im very new in vb.net  can you give me some sample code

for each one that displays to my listview? the two textboxes

are for inputing numbers between 1 to 30..

i hope for your reply

____________________________
pinon

05-07-2006 at 03:40 AM
View Profile Send Email to User Show All Posts | Quote Reply
sana
Level: Protégé

Registered: 01-09-2006
Posts: 6
icon Re: please guys help me out

hello i m ne user on ths forum i have read ur problem n i will ry my bet to reply u within a day or two m doing bachelors in computer sciences .. n nowadays im studying it as a subject so i try to sort out ur problem my email address is palkicartoon@yahoo.com and palkicartoon@hotmail.com but i almost use yahoo id so u can mail me too i wil try to solve out it coz it seems a bit simple so i will try my best to do it..
thank u ALLAH HAFIZ

01-09-2006 at 02:39 PM
View Profile Send Email to User Show All Posts Visit Homepage | Quote Reply
sana
Level: Protégé

Registered: 01-09-2006
Posts: 6
icon Re: please guys help me out

Hello Pinon here is ur Solution i m sotty its late but ne how i have reallly forgootn to reply here !!!!


Public Class Form1
    Inherits System.Windows.Forms.Form

#Region " Windows Form Designer generated code "

    Public Sub New()
        MyBase.New()

        'This call is required by the Windows Form Designer.
        InitializeComponent()

        'Add any initialization after the InitializeComponent() call

    End Sub

    'Form overrides dispose to clean up the component list.
    Protected Overloads Overrides Sub Dispose(ByVal disposing As Boolean)
        If disposing Then
            If Not (components Is Nothing) Then
                components.Dispose()
            End If
        End If
        MyBase.Dispose(disposing)
    End Sub

    'Required by the Windows Form Designer
    Private components As System.ComponentModel.IContainer

    'NOTE: The following procedure is required by the Windows Form Designer
    'It can be modified using the Windows Form Designer.  
    'Do not modify it using the code editor.
    Friend WithEvents Button1 As System.Windows.Forms.Button
    Friend WithEvents ListBox1 As System.Windows.Forms.ListBox
    Friend WithEvents Button2 As System.Windows.Forms.Button
    <System.Diagnostics.DebuggerStepThrough()> Private Sub InitializeComponent()
        Me.Button1 = New System.Windows.Forms.Button
        Me.ListBox1 = New System.Windows.Forms.ListBox
        Me.Button2 = New System.Windows.Forms.Button
        Me.SuspendLayout()
        '
        'Button1
        '
        Me.Button1.Location = New System.Drawing.Point(48, 32)
        Me.Button1.Name = "Button1"
        Me.Button1.Size = New System.Drawing.Size(104, 23)
        Me.Button1.TabIndex = 0
        Me.Button1.Text = "Sort Array"
        '
        'ListBox1
        '
        Me.ListBox1.Location = New System.Drawing.Point(112, 72)
        Me.ListBox1.Name = "ListBox1"
        Me.ListBox1.Size = New System.Drawing.Size(120, 199)
        Me.ListBox1.TabIndex = 1
        '
        'Button2
        '
        Me.Button2.Location = New System.Drawing.Point(176, 32)
        Me.Button2.Name = "Button2"
        Me.Button2.Size = New System.Drawing.Size(120, 23)
        Me.Button2.TabIndex = 2
        Me.Button2.Text = "By Specific Position"
        '
        'Form1
        '
        Me.AutoScaleBaseSize = New System.Drawing.Size(5, 13)
        Me.ClientSize = New System.Drawing.Size(384, 397)
        Me.Controls.Add(Me.Button2)
        Me.Controls.Add(Me.ListBox1)
        Me.Controls.Add(Me.Button1)
        Me.Name = "Form1"
        Me.Text = "Form1"
        Me.ResumeLayout(False)

    End Sub

#End Region
    Dim arr(10) As Integer
    Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
        Dim i As Integer

        For i = 0 To arr.Length - 1
            arr(i) = InputBox("Enter Numbers", "Numbers")
        Next

    End Sub
    Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
        Dim i As Integer, j As Integer
        Dim temp As Integer

        For i = 0 To arr.Length - 1
            For j = 0 To arr.Length - 2
                If arr(j) > arr(j + 1) Then
                    temp = arr(j)
                    arr(j) = arr(j + 1)
                    arr(j + 1) = temp
                End If
            Next
        Next

        For i = 0 To arr.Length - 1
            ListBox1.Items.Add(arr(i))
        Next
    End Sub

    Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
        ListBox1.Items.Clear()
        Dim stloc, endloc, i, j As Integer
        stloc = InputBox("Enter Start Loc", "Number")
        endloc = InputBox("Enter End Loc", "Number")
        'dim temparr() As Integer
        Dim temp As Integer
        For i = stloc To endloc
            For j = stloc To endloc - 2
                If arr(j) > arr(j + 1) Then
                    temp = arr(j)
                    arr(j) = arr(j + 1)
                    arr(j + 1) = temp
                End If
            Next
        Next

        For i = stloc To endloc
            ListBox1.Items.Add(arr(i))
        Next
    End Sub
End Class

19-10-2006 at 05:57 PM
View Profile Send Email to User Show All Posts Visit Homepage | Quote Reply
sana
Level: Protégé

Registered: 01-09-2006
Posts: 6
icon Re: please guys help me out


    Dim arr(10) As Integer
    Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
        Dim i As Integer

        For i = 0 To arr.Length - 1
            arr(i) = InputBox("Enter Numbers", "Numbers")
        Next

    End Sub
    Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
        Dim i As Integer, j As Integer
        Dim temp As Integer

        For i = 0 To arr.Length - 1
            For j = 0 To arr.Length - 2
                If arr(j) > arr(j + 1) Then
                    temp = arr(j)
                    arr(j) = arr(j + 1)
                    arr(j + 1) = temp
                End If
            Next
        Next

        For i = 0 To arr.Length - 1
            ListBox1.Items.Add(arr(i))
        Next
    End Sub

    Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
        ListBox1.Items.Clear()
        Dim stloc, endloc, i, j As Integer
        stloc = InputBox("Enter Start Loc", "Number")
        endloc = InputBox("Enter End Loc", "Number")
        'dim temparr() As Integer
        Dim temp As Integer
        For i = stloc To endloc
            For j = stloc To endloc - 2
                If arr(j) > arr(j + 1) Then
                    temp = arr(j)
                    arr(j) = arr(j + 1)
                    arr(j + 1) = temp
                End If
            Next
        Next

        For i = stloc To endloc
            ListBox1.Items.Add(arr(i))
        Next
    End Sub
End Class
Sorry the 1st send answer was incorrect this is the correct 1

19-10-2006 at 06:01 PM
View Profile Send Email to User Show All Posts Visit Homepage | Quote Reply
sana
Level: Protégé

Registered: 01-09-2006
Posts: 6
icon Re: please guys help me out

this is an idea for u do same for list box

19-10-2006 at 06:03 PM
View Profile Send Email to User Show All Posts Visit Homepage | Quote Reply
AndreaVB Forum : VB.Net : please guys help me out
Previous Topic (Buttons on VB.Net 2005)Next Topic (Followup: Add data in VB .Net) New Topic New Poll Post Reply
Surf To:


Not Logged In? Username: Password: Lost your password?
Partners: Download Actual Software | Free Software Download
borderAndreaVB free resources for Visual Basic developersborder

borderAndreaVB Visual Basic and VB.NET source code resources - Copyright © 1999-2007 Andrea Tincaniborder