|
Your code won't work because you're not making copies of the List(Of Integer) objects. Your code holds references to 12 seperate List(Of) objects, and when you use Array.Copy or Array.Clone, you are copying the references to those Lists, not the values in them. So, you now have two arrays with references to the same 12 Lists. Any changes you make in one array will be seen in the seconds array because they both point to the exact same objects.
' Setup source array of Lists.
Dim originalLists(3, 4) As List(Of Integer)
For i = 0 To 3
For j = 0 To 4
originalLists(i, j) = New List(Of Integer) From {1, 2, 3}
Next
Next
' Now make copies of the original Lists.
Dim copyLists(3, 4) As List(Of Integer)
For i = 0 To 3
For j = 0 To 4
copyLists(i, j) = New List(Of Integer)
copyLists(i, j).AddRange(originalLists(i, j))
Next
Next
|
|
|
|
|
I was doing that way, looping each element, but it is slow and unefficient. I wondered if there exist a better approach.
|
|
|
|
|
Because you're using Lists for what is essentially the 3rd dimension of your array, no, there isn't.
|
|
|
|
|
Am i wrong?
I'm using DevExpress TreeList and I want to use it as button.
I disabled the AllowEdit and adding some nodes.
But there's no Node.Click or else, did DevExpress TreeList support that?
Real Programmers code in Binary??
|
|
|
|
|
Since we didn't develop the DevExpress TreeView, we're not the ones you should be asking about this.
Ask this in DevExpress support forums. Since they wrote the control, they are FAR better equiped to answer questions about it, wouldn't you think?
|
|
|
|
|
Alpherattz wrote: I'm using DevExpress TreeList and I want to use it as button.
Their documentation can be found here[^], and they have an active forum.
No, can't help, my knowledge on DevExpress-stuff is limited to "need-to-know".
Bastard Programmer from Hell
|
|
|
|
|
You can use the CalcHitInfo method of TreeList control in the MouseUp event to catch the required click event as shown below
Private Sub treeList1_MouseUp(ByVal sender As Object, ByVal e As System.Windows.Forms.MouseEventArgs) _
Handles treeList1.MouseUp
ShowHitInfo(treeList1.CalcHitInfo(New Point(e.X, e.Y)))
End Sub
Private Sub ShowHitInfo(ByVal hi As DevExpress.XtraTreeList.TreeListHitInfo)
Dim msg As String = hi.HitInfoType.ToString() & vbCrLf
If (hi.Column Is Nothing) Then
msg &= "No column" & vbCrLf
Else
msg &= "Column: " & hi.Column.GetCaption() & vbCrLf
End If
If hi.Node Is Nothing Then
msg &= "No Node" & vbCrLf
Else
msg &= "Node: " & hi.Node.Id.ToString() & vbCrLf
End If
If hi.Column IsNot Nothing AndAlso hi.Node IsNot Nothing Then
msg &= "CellValue: " & hi.Node.GetDisplayText(hi.Column.AbsoluteIndex) & vbCrLf
End If
MessageBox.Show(msg)
End Sub
|
|
|
|
|
thankyou very much, problem solved..
modified 20-Feb-12 2:33am.
|
|
|
|
|
The double click event of Treelist control does not have the hitinfo. Hence, the node cannot be detected.
Further the Double click has the default behaviour of collapsing and expanding the nodes. Hence, it is better to use the right click. In which case you can use the following code to handle the right click
Private Sub treeList1_MouseUp(ByVal sender As Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles treeList1.MouseUp
If e.Button <> Windows.Forms.MouseButtons.Right Then
Exit Sub
End If
ShowHitInfo(treeList1.CalcHitInfo(New Point(e.X, e.Y)))
End Sub
I think this may meet your requirement.
|
|
|
|
|
yes DoubleClick event didn't work, just now i tried MouseDoubleClick event and it worked perfectly, but still don't understand the difference between TreeList1_DoubleClick and TreeList1_MouseDoubleClick.
thankyou again..
|
|
|
|
|
Double click event is for the whole control.
Whereas the MouseDoubleClick event gives the hitinfo, so that parts of control like node, cell etc. can be detected using X, Y coordinates of the clicked location.
|
|
|
|
|
nice info, thankyou very much.
|
|
|
|
|
|
how to make slide puzzle game with VB 6.0??
may i can view the source code..
|
|
|
|
|
I would suggest that Google is your first port of call! Google : vb6 how to make a game[^]
You might think the response is harsh but VB6 even though runs on operating systems upto Windows 7 and through rumours "will work as" from Microsoft work on Windows 8. It is not a supported language anymore. Have a look at the Express editions on the microsoft website as they are free
Lobster Thermidor aux crevettes with a Mornay sauce, served in a Provençale manner with shallots and aubergines, garnished with truffle pate, brandy and a fried egg on top and Spam - Monty Python Spam Sketch
|
|
|
|
|
Unless you dig up some old grave you're not going to get VB6 source code for this.
|
|
|
|
|
Recently I had to go back though some old VB6 code and make some fixes. It was odd, we changed our Database server to something newer but kept with SQL 2000 (yeah we're current in some things ) When we did that for some reason our one application query that uses temp tables went from running in under 1 second to 30+. For what ever reason using the same connection for temps and the "regular" tables no longer worked after 12 years (go figure).
Not knowing what the problem could be I started to throw together a test program and what a pain in the butt that was. I wanted to check the one table and then remembered that I couldn't do a ExecuteScalar and I can't count the times I did something like conn.close() and then found out that oh yeah you don't use the (). Heck even For Each loops work a bit different, oh and then there is the starting at 1 and not 0 for arrays.
I started my programming career using VB around half way through the life of VB5, then moved to 6 and then jumped to 2005 and haven't looked back. The best way I can describe VB6 now is it's like running 15 miles. It basically sucks while your doing it, but you look back and think "hmm, that wasn't too bad and somewhat enjoyable... I think I'll do that again". Don't get me wrong I still enjoy VB and it's usually my goto language, but I think I'll stick with .Net
|
|
|
|
|
yes you should stick with .Net,
better in design and got a lot of languages..
|
|
|
|
|
I said I would research this, so I am. I know little about VB or VBSCRIPT. There is an admin where I work that is facing the daunting challenge of 100s of new users coming into our facility. 99% of the users will receive a canned Windows 7 machine with limited privs - meaning no local admin meaning no ability to install printer drivers.
He uses the following script now (snippet):
Set WshNetwork = WScript.CreateObject("WScript.Network")
PrinterPath = "\\dulpqs51\dulprn126"
WshNetwork.AddWindowsPrinterConnection PrinterPath
WshNetwork.SetDefaultPrinter PrinterPath
-----
When users execute this script, they receive a "please supply the admin info" prompt. He asked me if there was some way to add a username/password to the script without giving away the information. I don't think there is. I know there are username and password parameters that can be passed, but I don't know about a secure way to include this in the script.
Thoughts and Ideas?
Charlie Gilley
<italic>You're going to tell me what I want to know, or I'm going to beat you to death in your own house.
"Where liberty dwells, there is my country." B. Franklin, 1783
“They who can give up essential liberty to obtain a little temporary safety deserve neither liberty nor safety.” BF, 1759
|
|
|
|
|
There is no scure way to do this in VBScript. But there MAY be alternaitves.
When is this script being executed?? Under what account??
|
|
|
|
|
The script is only executed when a standard user - from their standard account - desires to add a printer to the computer.
Charlie Gilley
<italic>You're going to tell me what I want to know, or I'm going to beat you to death in your own house.
"Where liberty dwells, there is my country." B. Franklin, 1783
“They who can give up essential liberty to obtain a little temporary safety deserve neither liberty nor safety.” BF, 1759
|
|
|
|
|
In that case, the script is running AS the user and has the users permissions. There is nothing you can do about it as VBScript doesn't have any facility to impersonate another user, like an admin.
Usually, normal users can add printers themselves. Soooo, I take it this was turned off in your Win7 load or by policy?
|
|
|
|
|
Hard to say why things are done around here . It may be that if a user were to launch the install file for the printer, it would work, and it's the script implementation that has issues. I'm just not sure.
I'll toss it over as a suggestion.
Appreciate the feedback.
Charlie Gilley
<italic>You're going to tell me what I want to know, or I'm going to beat you to death in your own house.
"Where liberty dwells, there is my country." B. Franklin, 1783
“They who can give up essential liberty to obtain a little temporary safety deserve neither liberty nor safety.” BF, 1759
|
|
|
|
|
If the domain is an Active Directory, admin can use GPOs to assign printers to users.
No memory stick has been harmed during establishment of this signature.
|
|
|
|
|
I am getting a syntax error in this SQL statement. But i can't figure out what it is.
Dim sql As String = "INSERT INTO Users (UserID, Password, CompleteName, Admin) VALUES (@User, @Pass, @Complete, @admin)"
Whole code segment is below
Dim sql As String = "INSERT INTO Users (UserID, Password, CompleteName, Admin) VALUES (@User, @Pass, @Complete, @admin)"
Dim com As New OleDb.OleDbCommand
com.Parameters.Add("@User", OleDb.OleDbType.Char).Value = txtUser.Text
com.Parameters.Add("@Pass", OleDb.OleDbType.Char).Value = txtpass.Text
com.Parameters.Add("@Complete", OleDb.OleDbType.Char).Value = txtcomplete.Text
com.Parameters.Add("@admin", OleDb.OleDbType.Char).Value = isadm
what is the error of SQL statement.
|
|
|
|