.NET Tutorials, Forums, Interview Questions And Answers
Welcome :Guest
 
Sign In
Register
 
Win Surprise Gifts!!!
Congratulations!!!


Top 5 Contributors of the Month
david stephan

Home >> Forum >> VB.Net >> Post New QuestionBookmark and Share Subscribe to Forum

Graphical Representation of Array Sorting in vb.net 2008

Posted By: Sushil     Posted Date: December 29, 2009    Points:2   Category :VB.Net
Hello Sir I have Visual Basic 6.0 code that shows Bars of sorting like Bubble sort,Selection sort etc in vb
but i want it in Vb.net 2008 can u give me that .then i will post u vb code

Responses
Author: nishithraj             
Posted Date: December 30, 2009     Points: 5   

Hi Sushant, Your requirement is not clear in the question. Can you elaborate your requirement?

Following is the code for bubble sort in VB.NET

For outer = n - 1 to 0 step - 1
For inner = 0 to outer - 1
If list(inner) > list(inner + 1) then
temp = list(inner)
list(inner) = list(inner + 1)
list(inner + 1) = temp
end if
Next
Next



For outer = n - 1 to 0 step - 1
For inner = 0 to outer - 1
If list(inner) < list(inner + 1) then
temp = list(inner)
list(inner) = list(inner + 1)
list(inner + 1) = temp
end if
Next
Next


And for the selection sort following is the code.

Sub SelSort(ByRef X() As Integer, ByVal start As Integer, ByVal stopp As Integer)
Dim begin As Integer = start
Dim smallsofar As Integer = begin
Dim tmp As Integer, i As Integer

If start < stopp Then
For i = begin + 1 To stopp + 1
If X(i) < X(smallsofar) Then smallsofar = i
Next i

tmp = X(begin)
X(begin) = X(smallsofar)
X(smallsofar) = tmp

SelSort(X, start + 1, stopp)
End If
End Sub

Sub Main()
Dim I As Integer
Dim x() As Integer = {5, 2, 4, 6, 1, 3}

Console.WriteLine("Unsorted Array:")
For I = 0 To x.GetUpperBound(0)
Console.Write("{0} ", x(I))
Next I

SelSort(x, 0, x.GetUpperBound(0) - 1)

Console.WriteLine("{0}SORTED ARRAY:", Chr(10))
For I = 0 To x.GetUpperBound(0)
Console.Write("{0} ", x(I))
Next I
End Sub


Author: Sushil             
Posted Date: December 31, 2009     Points: 5   

Hello sir plz give me ur Email Id then I will send u my Vb Project ,can u conert it in vb.net 2008
plz help me



Post Reply

You must Sign In To post reply
 
 
Find more Forum Questions on C#, ASP.Net, Vb.Net, SQL Server and more Here
Quick Links For Forum Categories:
ASP.NetWindows Application  .NET Framework  C#  VB.Net  ADO.Net  
Sql Server  SharePoint  OOPs  SilverlightIISJQuery
JavaScript/VBScriptBiztalkWPFPatten/PracticesWCFOthers
www.DotNetSpark.comUnAnsweredAll

Hall of Fame    Twitter   Terms of Service    Privacy Policy    Contact Us    Archives   Tell A Friend