|
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
|
|
|
|
|
Visual Basic 2005 Professional Edition:
I need to drag and drop an image from one PictureBox to another PictureBox where:
1) the image is visible while being dragged
2) the image can be dropped at any location within the target PictureBox
3) the image can be rotated within the target PictureBox
|
|
|
|
|
|
jo0ls at xtremevbtalk.com wrote a program that does it all!
1) Transparent backround on dragged objects.
2) See object as it is being dragged.
3) Rotate object.
4) Nudge object.
5) Delete object.
6) Drag multiple objects.
7) Drag multiple copies of an object.
8) Redrag objects.
9) Drag objects of any size
Wow!
<http: www.xtremevbtalk.com="" showthread.php?t="265584&goto=newpost">
|
|
|
|
|
Hi,
does anybody know ( or have ) some project to read doc/rtf. files? I would like to make something like document reader in VB. I'm looking for simple project for "notepad" or wordpad in visual basic.
Thanks
|
|
|
|
|
|
I want to make changes to the HTMLdocument that resides in a WebBrowser.Document
I can navigate to a web page,
WebBrowser1.Navigate(address)<br />
and the image looks good in WebBrowser1. After the document completes, I capture the event when a page element is clicked on:
Dim ClickedElement As HtmlElement<br />
Private Sub Document_Click(ByVal sender As Object, ByVal e As HtmlElementEventArgs)<br />
If (WebBrowser1.Document IsNot Nothing) Then<br />
Dim pt As Point = System.Windows.Forms.Cursor.Position<br />
pt = PointToClient(pt)<br />
pt.Offset(-WebBrowser1.Left, -WebBrowser1.Top)<br />
ClickedElement = WebBrowser1.Document.GetElementFromPoint(pt) 'WebBrowser1.Document.Window.Position)<br />
ClickedElement.ScrollIntoView(True)<br />
tblElements.Rows.Clear()<br />
AddElementToTable(ClickedElement, 0, Direction.Ascending)<br />
DataGridView1.DataSource = tblElements<br />
End If<br />
End Sub
Now I can do either of these:
'Change the ID of an element<br />
If clickedElementID = "" then ClickedElement.ID = "t_19"<br />
or
<br />
'Add a new element after the one that was clicked<br />
Dim newID As String = ClickedElement.Id & "_t1"<br />
Dim newElement As HtmlElement = WebBrowser1.Document.CreateElement(newID)<br />
newElement.Id = newID<br />
ClickedElement.InsertAdjacentElement(HtmlElementInsertionOrientation.AfterEnd, newElement)
Both of these changes show up if I check the element:
For Each el As HtmlElement In ClickedElement.Parent.Children<br />
Console.WriteLine("Sibling id: " & el.Id)<br />
Next
Sibling id: t_19
Sibling id: t_19_t1
But I can't figure out how to have the display reflect the change or how to save the UPDATED version of the html. The WebBrowser1.documenttext doesn't reflect any changes.
Thanks!
Grant
Everyone else's job looks easy
|
|
|
|
|
Can somebody please tell me how to find the remainder when one digit is divided by another digit?
Thanks and Regards
Amaneet Brar
|
|
|
|
|
Use the modulo operator MOD.
---
b { font-weight: normal; }
|
|
|
|
|
i need to open the word document in the server and display it
to the user, and save changes if any to the server back
i am able to open and display it in explore (.doc file is in url)
but save back to server ?? so for this i need some control with in with
i can open and save ,
if any of u had gown through the same problem.
pls respond
Understanding comes from failures
SUCESSES comes form understanding failures
|
|
|
|
|
What do you mean by "server"? A web server???
Dave Kreskowiak
Microsoft MVP - Visual Basic
|
|
|
|
|
ptr_Electron wrote: but save back to server ?? so for this i need some control with in with
i can open and save ,
Check with your system administrator whether you have an appropriate permission to write (save) to your file.
|
|
|
|
|
Does anyone have a good example of a TCP/IP server using the TCPListener and TCPClient classes in VB.Net 2005?
I need to write an application that listens for TCP/IP client connections. Once a client is connected the server must maintain these connections in order to process any incoming commands and to send out status information to the clients.
Any help would be appreciated.
Tony
|
|
|
|
|
|
How do I setup project written in vb.net 2003, so application could be ran from the network drive?
David Pudel
pudel.d@dreyfus.com
|
|
|
|
|
First you copy/install the application files onto the network drive.
Next, you must install all of your app's dependencies on to each client system that will run your app. This includes the .NET framework, MDAC (if you're using ADO.NET), any ActiveX or COM objects used, etc. If there are a lot of dependencies, then you might want to write a "Client Installer" for your app to simplify the process for your users.
|
|
|
|
|
hello
i have created a DSN server named "BLTPS" through control pannel ODBC service and using a userid and password property.
now how i will connect to database through my code plz tell me which namespaces i have to add and what is the syntax.
plz help me soon
thanks
|
|
|
|
|
What you need to use is called ADO.NET. It's a collection of .NET classes under the System.Data namespace which allow you to work with various databases. This is a big subject and I highly recommend that you read up on this on MSDN. See the below link.
You should also search this website and the Internet on this subject too. There's plenty of examples out there.
http://msdn.microsoft.com/library/en-us/cpguide/html/cpconoverviewofadonet.asp[^]
That said, you need to use the data provider classes under the System.Data.ODBC namespace. Read the above link to understand how to use them.
|
|
|
|
|
actuualy i have worked on oledb but not on ODBC. i have read a example in it they use ADODB but when i use it in my code it gives me error. there is no namespace of this name how i can use it plz tell me
|
|
|
|
|
iramg wrote: i have read a example in it they use ADODB but when i use it in my code it gives me error.
That's the old ADO library used by VB6 and older versions.
To use ADO.NET, you need to add a reference to the System.Data.dll in your project. In Visual Studio 2003, you can do this by right clicking on your project's References folder, select Add References, select System.Data.dll in the listbox, click Select, and then click OK. This will give you access to the System.Data namespace and all of its classes. You'll need to use the System.Data.Odbc.OdbcConnection class to connect to the database. The below link to MSDN will show you a quick example on how to use this class.
http://msdn.microsoft.com/library/en-us/cpref/html/frlrfSystemDataOdbcOdbcConnectionClassTopic.asp[^]
I hope this helps!
|
|
|
|
|
i have a multi colum ListView i can show data in listview but now i want to save the data in table from listview how can i read data from listview
syed imran azmat
|
|
|
|
|
Dim listItem As ListViewItem
Dim subItem As ListViewItem.ListViewSubItem
For Each listItem In ListView.Items
For Each subItem In listItem.SubItems
...
Your code here
...
Next
Next
|
|
|
|
|
Is there any particular reason why you are using an ODBC provider and not the SQL Server provider in ADO.NET?
Anyway, this code:
OdbcCmd.CommandText = "Call AddMember(?, ?, ?, ?)"
OdbcCmd.CommandType = CommandType.StoredProcedure Appears to be causing the problem. If you use the CommandType.StoredProcedure then the CommandText should contain the name of the stored procedure and nothing more.
"On two occasions, I have been asked [by members of Parliament], 'Pray, Mr. Babbage, if you put into the machine wrong figures, will the right answers come out?' I am not able to rightly apprehend the kind of confusion of ideas that could provoke such a question."
--Charles Babbage (1791-1871)
My: Website | Blog
|
|
|
|
|
Thanks for the reply. I'm new to VB so I haven't seen anything that says to use one or the other and why. I tried your suggestion and I'm still getting an error. Here are the results when I just provice the procedure name:
MSSQLJOB 964-9a4 EXIT SQLExecDirectW with return code -1 (SQL_ERROR)
HSTMT 03A31BC0
WCHAR * 0x010C08E8 [ -3] "AddMember\ 0"
SDWORD -3
DIAG [42000] [Microsoft][ODBC SQL Server Driver][SQL Server]Procedure AddMember expects parameter @mbr_acctnum, which was not supplied. (201)
DIAG [42000] [Microsoft][ODBC SQL Server Driver][SQL Server]Procedure AddMember expects parameter @mbr_name, which was not supplied. (201)
DIAG [42000] [Microsoft][ODBC SQL Server Driver][SQL Server]Procedure AddMember expects parameter @mbr_ssn, which was not supplied. (201)
DIAG [42000] [Microsoft][ODBC SQL Server Driver][SQL Server]Procedure AddMember expects parameter @mbr_employee, which was not supplied. (201)
|
|
|
|
|
You didn't answer my previous question: Is there any particular reason why you are using an ODBC provider and not the SQL Server provider in ADO.NET?
If there is a specific provider for your database in .NET (and for SQL Server there is) then use the classes of that provider rather than use ODBC. Use SqlCommand, SqlConnection and so on rather than OdbcCommand, OdbcConnection and so on unless you have a very compelling reason to use the ODBC provider.
Scottish Developers upcoming sessions include:
.NET debugging, tracing and instrumentation by Duncan Edwards Jones and Code Coverage in .NET by Craig Murphy
My: Website | Blog
|
|
|
|