I know a lot of you out there know this pretty well so here I go:
I want to create code that will happen if any command buttons (of my choice) are clicked. I think this has something to do with a control array...
Also, is there anyway that I can code so that when any button is pressed, it will detect if there is data (datachanged) in a label and it will keep checking to see if there is a blank label (in a sequence...lbl1, lbl2, lbl3, etc...), and if there is a free one, have it put data in there?
This might sound confusing so let me know if you need me to explain it further.
Always appreciative
Try StreamFab Downloader and download from Netflix, Amazon, Youtube! Or Try DVDFab and copy Blu-rays!
+ Reply to Thread
Results 1 to 11 of 11
Thread
-
-
Originally Posted by g_shocker182
Paste a command button on a form, rename it to something meaningful, and then right click on it, select copy and then right click on the form and select paste. A dialog will tell you a button called xyz is already present and ask you if you want to create a control array. Answer yes.
It's the simplest way to create a control array. You can copy and paste any of these two buttons any times you want and each time a new button will be added on the form.
To add code to this command button array, double click on any of the buttons and the editor will take you to the click event of the button. Notice the "Index as Integer" parameter present. This is the index that tells the code which of the buttons was clicked on.
Your code should work depending on the Index value. E.g.
Select case Index
case 0 ' this is the first button. Note that the array is 0 based
MsgBox "Button 0 clicked
case 1
Debug.Print "Button 1 was clicked"
case 2
...
Case Else
' Always have this to trap un-expected or invalid values
End Select
Originally Posted by g_shocker182
You can check the .Caption property of each label whenever a button is clicked (depending on what you want to achieve) and put a new caption (new data) on the label in the form.
Sample code for this (assuming the labels are named lblLabel():
Dim i as integer
For i = 0 to lbllabel.count - 1
if lbllabel(i).caption = "" then
lbllabel(i).caption = "Data value"
End If
Next i
Edited to correct a couple of typing mistakesThe more I learn, the more I come to realize how little it is I know. -
Thanks, but I found a solution to the second part, which had yield another question:
In a listbox, how do I clear a selected entry (via a cmd)? -
I assume that you use a list box where you have enabled the "MultiSelect" property and you can select more than one entries. But even in single select cases,
List1.Selected(item) = False
will de-select entry "item" in the list box. "item" is a number and you can use any number between 0 and List1.ListCount - 1
Another way to de-select any possibly selected item would be:
List1.ListIndex = -1The more I learn, the more I come to realize how little it is I know. -
I think you misunderstood me. I wanted the code for having a selected entry be deleted as in a { = "" } kinda deal. It was nice to learn what you did put, though.
thanks
Edit: ufit, if you don't have anything constructive to add then don't bother. -
Originally Posted by g_shocker182
List1.List(ItemIndex) = ""
This command removes items from the list of the listbox.
To get a better understanding, the listbox can be considered as an array of elements. This array has two sequences. The first, .List, contains the literals displayed in the listbox. The .ItemData() array can contain other information, like additional information your program needs but don't need displayed. You can access each of them like in:
List1.List(idx) = "datavalue"
List1.ItemData(idx) = "datavalue2"
The .ListIndex property contains the currently selected item in the list.
The .ListCount property tells you how many items are in the list.
If you enable MultiSelect, then the .Selected() array contains True or False, depending on whether each item is selected or not (visually shown by a selected background or if you enable checkboxes next to the entries, by a checkmark.
Ufit, C++ is great and several algorithms lend themselves to C++ like nothing else. But try to create a User Interface with C++ and you will be spending the best part of a week for something you can do with VB in a couple of hours.
Don't start a war here. Tools are for doing your work. And you need a different tool to open a beer than open a bottle of wine.The more I learn, the more I come to realize how little it is I know. -
Ouch!
No guys I didn't want to start a war. Sorry if I touched somebody
The problem is I know VB6 and 7.NET and even got A at college
but I couldn't do do some complex tasks like running threads and managing libraries files and so on. IMHO VB is great and has wonderfull
graphical interfeace. Really fat graphics)) But I was forced by its limits to
go back to C++ which is great. Actually all that stuff from VB is now
accesible through Microsoft new classes implemented in MFC. It's so simple
just like VB but much MUCH more powerfull. Ufffff, that'd be all.
I'm currently writing a program for compression in divX 5.1.1 that will
try to predict final size of AVI and use maximum quality for poor frames.
There are new motion search algorithms in 5.1.1. I could achieve ratio 1:15 for PERFECT I-frames dudes! -
Ufit,
nice project you are doing.
And you are right in your comments. C++ is the right tool once you try to delve into the OS nerve system. And not for that only. I started a project to analyse MPEG2 streams (in VB6).
The first hik-up was to access files larger than 2Gb. (Crazy me). Well, got over that with some API calls and funny hi-lo order bytes passed to them to seek in the files.
Then I was confronted with the slow speed VB was showing in parsing bit streams. VB is just no good in managing bits or strings of bits. Got over that by deleting the VB code and replace it with a C++ dll that was doing exactly the same task, only 25 times (!!) faster.
Then I banged myself at the heap barrier, when my VB user defined data types (structures) grew too big to hold a single frame.
Then I got fed up and gave up
But, for building a form and a fancy user interface, VB is a joy and C++ is a pain.The more I learn, the more I come to realize how little it is I know. -
Heh how nice VB is, see I
I stepped into another problem - bitrate redistribution - it's kinda pain.
I can compress and save movie to avifile (really fast) but it comes out
ugly. Missing bits to motion algorithm. Funny thing - codec compresses
frames that should not be compressed so much. I can get compr. ratios
1:1000 and I can't help it(. Codec is amazing it compresses some images
with 1:300 without noticeable change. I must think of sth. DivX is a real
wirdow - complete random behavior.
Similar Threads
-
Calling MediaInfo from Visual Basic to et video info
By SearchQuality in forum ProgrammingReplies: 18Last Post: 2nd Nov 2011, 06:36 -
MPEG-4 Visual
By nirbhayn in forum Video ConversionReplies: 9Last Post: 4th Jul 2010, 14:43 -
visual basic code
By kudoshinichi in forum ProgrammingReplies: 1Last Post: 21st Jan 2009, 08:30 -
Programming FFMPEG (Visual Basic)
By Ace-Of-Spades in forum ProgrammingReplies: 4Last Post: 9th Oct 2007, 06:18