|
Hi !
I'm using VB 6. I want to develop a class (.cls) in which I would like to instanciate a Timer (m_myTimer) and react to the event m_myTimer_Timer().
I know how to do that in a form (I put on my form the 'Timer' control), but I'm not able to do it in my class. I tried to do that :
<br />
Dim WithEvents m_myTimer As Timer<br />
<br />
Private Sub Class_Initialize()<br />
<br />
m_myTimer.Enabled = True<br />
m_myTimer.Interval = 2000<br />
<br />
End Sub<br />
<br />
Private Sub m_myTimer_Timer()<br />
<br />
' Handle event <br />
<br />
End Sub<br />
but I get an error at line 'm_myTimer.Enabled= True'. I guess I have somewhere to do something like 'Set m_myTimer=whatever', but I can't figure out what to do.
Thank you for your help !
Jerome
|
|
|
|
|
Try changing this line:
Dim WithEvents m_myTimer As Timer
to this;
Dim WithEvents m_myTimer As New Timer
--
Andrew.
|
|
|
|
|
I added the crystal report component to my vb application and it runs fine
when I run the report in preview mode behind a command button. But when I
package and deploy this application, they hit the button and the report does
not run at all in preview mode. I dont get an error or anything, the report
is in correct path but it just does not open. I have the latest version of
vb which is SP 5.Any ideas?
lenhan
|
|
|
|
|
Did you check that that crystal ocx is registered correctly?
Cheers
Schalk
|
|
|
|
|
I was wondering what a really good/fast sort routine I could use to sort a text array. I will have about 250,000 records to go through.
A name of a routine would be great, a link even greater.
thx
Quinn
|
|
|
|
|
the fastest i know is quick sort but i don't have any link sorry
Michael
|
|
|
|
|
ok thx, I ported a qsort routine I had done in C when I got home and it works great.
|
|
|
|
|
I created a simple class module in Visual Basic called Child.
When I try to dim it in my project the auto completion pop up shows my class in the list as "child" rather than "Child".
Visual Basic treats the lower case version as a different object, so when i try to dim it, it gives me an object required error.
My problem is that no matter what I do I cant use this statement
Dim c as Child
becuase VB automatically changes it to the lowercase version like this
Dim c as child
Im not sure why it behaves like this, does some one know how to correct this?
Thanks for you help!
|
|
|
|
|
May be your having some other oject with tha name Child or change the class name to some thing else and try it.
Gau
Gaurika Wijeratne. // www.gaurika.com
|
|
|
|
|
I am using a listview control in Details mode that has three columns as follows:
Q100 C true
Q200 N false
Q300 N true
I would like to display a checkbox in the third column. Does anyone have any suggestions for adding a checkbox in the third column.
TIA!
- Derek
|
|
|
|
|
You may want to look into using a datagrid instead. You would have to do some code for the bubbling events, but it would surely be easier than drawing your own custom control.
David Stone
dstone@newcenturytitle.com
"I am but mad north-northwest, when the wind is southerly I know a hawk from a handsaw." -Hamlet
|
|
|
|
|
Thx for the reply!
I have resorted to using the listview control but with the checkedboxes property set to True. It's not exactly what I wanted but I am tired of fighting with the listview and the datagrid. The problem that I had with the datagrid is that the dragdrop events (lack of itemdrag) were more difficult to deal with as compared to the listview. Although, at least with the datagrid I could add checkboxes to easily to a datacolumn.
I was able to add checkboxes to a listview but the problem is that I just ended up painting the controls on top of the listview verses binding the control to the actual column. So when I scrolled thru the list the checkboxes were not bound to a specific row (sub-item). If I get some free time then I might try making a listview control that acts more like a datagrid.
- Derek
|
|
|
|
|
Hi,
Is it possible to post systeme message easily in VB.
Or I need to redirect the kernel function?
thx Michael
|
|
|
|
|
What do you mean by system message? There are a number of API functions that you can use, but I do not know exactly what you are trying to.
Build a man a fire, and he will be warm for a day Light a man on fire, and he will be warm for the rest of his life!
|
|
|
|
|
Call the System shell
shell "net send [username or computer name] [message]", vbHide
Fernando Finelli
|
|
|
|
|
Hi !
I'm a beginner with VB 6.0, trying to use it for a GUI, because I heared it's the best choice for that. But, actually, I'm facing some problems I thought I would never have to worry with VB.
Here is my problem :
I want to display a Button. This button should be able to display a text OR a picture, depending on the user's choice. I also want the picture to be resized according to the button size.
Doing that, I read in the help that the Sytle property of a button, choosing the appearance to be text or picture, cannot be changed during runtime. Well, then I thought I would just put an 'Image' Control, on top of my button. This Image control would be visible when an image has to be displayed on the button, and would not be visible when the normal text on the button has to be displayed. BUT, it seems I just cannot put the Image Control in front of the button, it always stays on the back !!!
Anyone could help me with that ?
Thank you !
Jerome
|
|
|
|
|
If you are still stuck you could do something like this:
1. Create two buttons, one with an image, the other with text
2. Stack the two buttons on top of each other
3. Use the ZOrder property of each button to control which button is on top(visible)
Hope this helps.
Nick Parker
|
|
|
|
|
Hi,
I have a relatively simple visual basic 6 application that consists of one executable. The program changes quite often and I don’t want to re-install it on every machine each time I make changes. What I’ve done before is instead of installing the application on users machines I only give them a shortcut that point to the executable. This makes changes to the program very easy, you just overwrite the executable and everybody has the updates. On most machines the program will work fine without having to install/register anything, sometimes though the program will need the crystal ocx installed or the data access components might not be the right version. The only way to make the shortcut to the application work on machines like this is to run the install set for the application, uninstalling it (leaving a shared files on the system) and the using the shortcut. Does anybody know how I can determine the applications dependencies and install it via a batch file perhaps?
Cheers
|
|
|
|
|
Once you have compiled your executable, if using the Visual Studio compiler it will create a list file with a .lst file extension to it. When you open this file you will find in the bootstrap section a list of all dependent files for the application and where they are to be installed to. I needed this information when I ran into a similar problem in which I created an application that checks the users file version again what the package will be installed with where you can run into versioning problems. Hope this helps.
Nick Parker
|
|
|
|
|
I am currently trying to set up a complex configuration file which
might look like this:
<configuration>
<configSections>
<sectionGroup name="MyGroup">
<section name="MySection"
type="System.Configuration.NameValueSectionHandler />
</sectionGroup>
</configSections>
<MyGroup>
<MySection>
<component id="1" start="0" length="2" default=""/>
<component id="2" start="2" length="10" default=""/>
[...]
</MySection>
<MyGroup>
</configuration>
So, how can I read all elements of MySection ? How can I access them ?
For your information, the id's aren't always starting with 1, they may
start with 500 or something like that.
Regards,
Michael
|
|
|
|
|
Hi !
I have an app (developped with VB6) which is dynamically creating several instances of the same ActiveX. Here is how I do it :
<br />
Dim objFoo(3) As Object<br />
<br />
Private Sub Form_Load()<br />
<br />
Set objFoo(1) = Form1.Controls.Add("MyOCX.MyActiveX", "object0")<br />
Set objFoo(2) = Form1.Controls.Add("MyOCX.MyActiveX", "object1")<br />
Set objFoo(3) = Form1.Controls.Add("MyOCX.MyActiveX", "object2")<br />
<br />
objFoo(1).Visible = True<br />
objFoo(2).Top = 2000<br />
objFoo(2).Visible = True<br />
<br />
End Sub<br />
The problem is that the ActiveX is raising an event in some situations. How can I handle this event in my app, and how will I know which instance of the ActiveX raised the event ?
Thank you for your help !
Jerome
|
|
|
|
|
Instead of using an array of objects, use the VBControlExtender class. Declare it WithEvents and you will be able to receive events.
You identify the object by its Name.
--
David Wengier
Sonork ID: 100.14177 - Ch00k
|
|
|
|
|
Hi,
I require some application data to be printed from my VB
application. I intend to use the standard Print dialog (that is
generally available in all MS applications) for this.
Using the ActiveX control CommonDialog I am able to pop up
the dialog with the desired settings (that is page from, page to,
orientation, number of copies etc).
But how do I pass the desired data to the dialog so that it can
print it? I could not find any method that accepts the data. When
I click the button [PRINT], nothing is printed.
Please help! Thanks in advance. I am placing a section of the code
below:
===============================================================
'cmd1 is an instance of the ActiveX control
'created by including Microsoft Common Dialog 6.0
'in the Controls dialog box under the Project menu
cmd1.DialogTitle = "Print text file from VB"
cmd1.Copies = 1
cmd1.FromPage = 1
cmd1.ToPage = 2
cmd1.FileName = "c:\abcd.txt" 'This is the file I want to print
cmd1.Orientation = cdlLandscape
cmd1.ShowPrinter 'Popup the standard print dialog
===============================================================
Is there any other way of doing this?
With best regards,
Sayan
Email:sayanmukherjee@indiatimes.com
|
|
|
|
|
You need to print the data yourself. Lookup the Printer Object in help.
--
David Wengier
Sonork ID: 100.14177 - Ch00k
|
|
|
|
|
Ok.. here's what I'm trying to do
I have a windows form (VB.NET) with a datagrid that display the content of a table in a database. (let's say countries for example) I can edit, delete and add records in this grid.
In another windows form, I have a combobox. This combobox displays all countries. I want to add an item in this combobox (Add a country) and when I select it, I have to show the first form to allow the user to add, edit, delete countries and then select one. All changes applied in the grid have to be applied in the combobox and the (Add a country) item must not appear in the grid.
How can I add an item manually in the combobox when this one is binded to a datasource? I don't know if it's possible, but if it is, if someone could send me some tips, I would appreciate!
Thanks
Marc
|
|
|
|