|
pleass this see
but in vb.net
|
|
|
|
|
Better be quick, your assignment for school must be due on Monday is it?
FAIL
|
|
|
|
|
|
please help!!!!!!!!!!!!!!!!!!!!!!!!!
|
|
|
|
|
If you want help you are going about it the wrong way.
READ THE POSTS AT THE TOP OF THE FORUM - They are easy to understand!
|
|
|
|
|
|
|
|
miladbiranvand wrote: ok ,now help
Ha, I almost gave a 5 to this for the amount of LOL.
|
|
|
|
|
I have a form with many image controls on it (which can be added during runtime, so the total number changes at random each time the app is run). I need to trap a mousedown event when the mouse is over one of the image controls (any one of them, again, at random).
As I am adding images during runtime, I cannot use a standard object.mousedown event trap as I do not know how many image controls there may be in total - and therefore cannot have a separate subroutine for each and every control.
Is there a way of trapping a mousedown anywhere/anytime, even when it is over ANY control of the form, and when detected then identify the control that the mouse is over at the time? (i.e. return the forms identity during the mousedown event)
I have rowsed the web and looked around, but cannot find a way to trap a mousedown without first having a object.mousedown subroutine for each and every control identity..............any ideas greatly appreciated!
|
|
|
|
|
As you dynamically add your picture boxes to your form, attach a event handler delegate to the object that is shared by all the picture boxes;
In the example below, a button keeps adding new picture boxes to the form, as you mouse over them the label will change to show the new name. You can add other handlers in the same way to capture when you leave the picture box etc.
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
'Counter for the new object name
Static counter As Integer
counter += 1
'Add a picture box
Dim newPicBox As New PictureBox
newPicBox.Name = "Custom Box " + counter.ToString
AddHandler newPicBox.MouseMove, AddressOf customMouseMove
'Add it to the forms collection
Me.Controls.Add(newPicBox)
'Set it up
newPicBox.BackColor = Color.AliceBlue
newPicBox.Top = 25
newPicBox.Left = 50
newPicBox.Width = 100
newPicBox.Height = 100
newPicBox.BringToFront()
End Sub
Private Sub customMouseMove(ByVal sender As Object, ByVal e As System.Windows.Forms.MouseEventArgs)
Dim picBox As PictureBox = sender
Label1.Text = "Over: " & picBox.Name
End Sub
|
|
|
|
|
I am afraid I am not that good a VB writer (yet).
What is the event handler delegate I need to use, I presume this goes at the start of the form's code (i.e. top of the page?)
Also, I think your line "counter +=1" has an error? and my VB6 doesnt like your line "newPicBox.BringToFront()"
I have a lot of fun experimenting with (and slowly learning) VB, but I havn't delved or learnt writing event handlers yet.
Perhaps you could add the necessary line(s) to your example - so I can copy, adapt, and learn from it along the way?
Many thanks for the very prompt and helpful response, sorry I don't have the experience to make the most of your assistance!!
|
|
|
|
|
How the hell was i supposed to know you are using a dead language! it doesn't say that in your original post.
You need to be specific. I think it is time you moved on to .Net, go grab the free version from MS website and start learning that. If you are starting out, don't entertain vb6, you are wasting your time, go straight to .Net or you will get a shock when you move to .net
Yes it will throw errors, because it is written in .Net
So, how do you do it in VB6, can't remember/don't know, and not going to even try and find out.
|
|
|
|
|
Actually, I have been a VB'er from way back, writing small home-brew apps in VB4, then 5 then 6..........at my age I am not sure I could learn something too different. thanks.
|
|
|
|
|
I know the feeling; i to started back at VB3, as a hobby for small home apps.
The jump to .Net is not that much of a culture shock. I would recommend you at leastdownload the free versions from microsoft and give it a go. It won't be long before you wont want to go back to VB6!
go on, be brave
Cheers,
|
|
|
|
|
|
I think the "newPicBox.BringToFront()" should be newPicBox.zorder as it is being done at runtime - not design time?
|
|
|
|
|
How can i generate bar code of 128 using vb6. i require free control (not trial) for it. help please
Tufail
|
|
|
|
|
Given that VB6 has been obsolete for a long time, why are you using it ? I doubt very much that anyone is still creating VB6 components, or supporting them.
Christian Graus
Driven to the arms of OSX by Vista.
Read my blog to find out how I've worked around bugs in Microsoft tools and frameworks.
|
|
|
|
|
Goto wikipedia, search Barcode 128, then select Code 128; there is a link to an open source generator with code, for c++, vb.
I haven't tried the link, or had a look at whats there. surely you can manage to do that yourself.
also google throws up heaps of things, go looooooooook!
|
|
|
|
|
Hi All,
I am trying to implement the following problem in VB with SQL Database:
1) Added a client "R1" in SQL database
2) under "R1", I have to add "R2" - i.e. "R2" client is referred by "R1".
3) similarly "R3" has to be added under "R2"
4) similarly "R4" has to be added under "R3"
So my multilevel Tree structure would be like this : R1 -> R2 -> R3 -> R4
Now how to work on Database to search and add all the clients under their respective referrals.
I am not able to present the problem clearly, but I want to implement a Tree like architecture while programming in VB. I have all the client details in my database.
If anyone can throw some light on this,or provide some reference for programming this kind of architecture, then it would be highly appreciated.
Thanks
R.
|
|
|
|
|
One way to look at this is as follows:
setup the table like:
KeyID Integer
ParentID Integer
Name Character
The data would be stored as:
KeyID ParentID Name
100 0 Acme Major Headquarters
200 100 Acme Northeast Division
300 200 Acme New York Office
400 100 Acme Southern Division
The important factor is that the field, ParentID, is set to zero indicating that this is the top-level customer record. You can then see that all the direct children of "Acme Major Headquarters" have a ParentID of 100.
Hope this helps.
|
|
|
|
|
How can I programmatically select a value in a datagridviewcomboboxcolumn?
I am filling the combobox with values from a datatable, but I'd like to be able to programmatically select a value in the combo depending on other cell value(s) in the row.
Not sure what I am missing, should be a fairly simple task.
"There's no such thing as a stupid question, only stupid people." - Mr. Garrison
modified on Friday, October 30, 2009 11:49 AM
|
|
|
|
|
I have this string in ComboBox "10a, 10b, 1a, 1b, 1c, 2a, 2b ....." I want to sort but not work corectly. Not sort 1a, 1b, 1c, 2a, 2b,10, 10b and sort 10a, 10b, 1a, 1b, 1c, 2a, 2b
|
|
|
|
|
You can get the "logical sort order" by using P/Invoke and the same code Windows Explorer does for sorting file names. I only have a C# snippet:
private class LP_StringComparerLogical : IComparer<string> {
public int Compare(string s1, string s2) {
if (s1!=null && s2!=null) return StrCmpLogicalW(s1, s2);
else return string.Compare(s1, s2, true);
}
}
[DllImport("shlwapi.dll", CharSet=CharSet.Unicode, ExactSpelling=true)]
private static extern int StrCmpLogicalW(string s1, string s2);
The prototype (see last 2 lines) probably looks like this in VB.NET:
Declare Unicode StrCmpLogicalW Lib "shlwapi.dll" (s1 As String, s2 As String)
Luc Pattyn
I only read code that is properly indented, and rendered in a non-proportional font; hint: use PRE tags in forum messages
modified on Thursday, October 29, 2009 3:37 PM
|
|
|
|
|