|
when you add reference a OCX to your project , then in toolbar mus be see a icon from control , now drag this icon to form and use properties, events, ...
|
|
|
|
|
How do you kill child threads when the parent thread that creates them is stopped?
I have an application that will spawn multiple child threads, but when the parent process is killed, the child threads keep running in the background until they've completed the task assigned to them.
How do you make them abort at the same time the parent aborts? I don't have any control over when the Parent process exits and cannot handle exit events.
Thanks.
SG
Cause is effect concealed. Effect is cause revealed.
|
|
|
|
|
An app remains alive, as long as there are threads running that have their IsBackground set to false,
so set it to true for those background tasks that should not prevent your app from terminating.
Luc Pattyn [Forum Guidelines] [My Articles]
This month's tips:
- before you ask a question here, search CodeProject, then Google;
- the quality and detail of your question reflects on the effectiveness of the help you are likely to get;
- use PRE tags to preserve formatting when showing multi-line code snippets.
|
|
|
|
|
The problem is not the main app exiting. The problem is when I terminate the app, the child threads continue running in the background until they've completed their task.
[Edit]
But MSDN documentation says
Any remaining background threads are stopped and do not complete
which is contrary to what I'm seeing. Am I doing something wrong? The fillip here is that this piece of code runs within SSIS. And this SSIS package is invoked by a Windows Service using SQL SMO.
I'm outta ideas...
SG
Cause is effect concealed. Effect is cause revealed.
|
|
|
|
|
MSDN is right.
An app remains alive, as long as there are threads running that have IsBackground==false (the default value),
so set it to true for those background tasks that should not prevent your app from terminating.
Luc Pattyn [Forum Guidelines] [My Articles]
This month's tips:
- before you ask a question here, search CodeProject, then Google;
- the quality and detail of your question reflects on the effectiveness of the help you are likely to get;
- use PRE tags to preserve formatting when showing multi-line code snippets.
|
|
|
|
|
I have an issue.
The InitializeLifetimeService method of some of my MarshalByRef objects is never called.
I wanted to know would such objects account for Memory Leakage.
Thank you.
Sundip
|
|
|
|
|
Hi to all,
I'm tring to convert project form vb6 to vb.net.
In vb6, I used LenB to determine the size of type.
But in vb.net not supported LenB,
Can anyone tell me what function use instead?
|
|
|
|
|
There are no byte strings in .NET, so there is no equivalent of the LenB function.
If you have binary data you would use a byte array to handle it.
Experience is the sum of all the mistakes you have done.
|
|
|
|
|
if there some way to use keys in some program for example (Ctrl + v) do something in program in vb ?
|
|
|
|
|
You need to explain better what you are trying to do.
|
|
|
|
|
i want to record sound from wavepad in vb by macro key in wavepad program can i do that ?
|
|
|
|
|
You can handle the keyboard events, maybe set myForm.KeyPreview true.
It is however much easier, if you have menus, to add a MenuItem for the action you want, and assign
a shortcut to that menu item. Then no extra code is required.
Luc Pattyn [Forum Guidelines] [My Articles]
This month's tips:
- before you ask a question here, search CodeProject, then Google;
- the quality and detail of your question reflects on the effectiveness of the help you are likely to get;
- use PRE tags to preserve formatting when showing multi-line code snippets.
|
|
|
|
|
I have a problem with inheriting in VB that has been beating me for two days now. I have one base class, all the variables are private with public wrappers for set and get. I also have several derived classes.
The functions and subs have all been overridden and everything works fine, but I can not change the public properties to modify the set methods. Everytime I do, I get an error using everything but MYBASE.Whatever, but using the MYBASE calls gives a strange value and I can't find out how it is occuring.
My question is. Can I override one of the public properties and change how the set method works, or do I have to re-declare the variable in the derived class to do it?
|
|
|
|
|
Veldrain wrote: My question is. Can I override one of the public properties and change how the set method works, or do I have to re-declare the variable in the derived class to do it?
If you want to override the behaviour yet continue to use the field on the base class you must change the field to be Protected. Private means it is accessible only to the class that defined it and no others. Protected means it is accessible only to the class that defined it plus any derived classes.
|
|
|
|
|
Thank you Colin. Every book and tutorial I found only mentioned overriding Functions and Subs. I was beginning to think properties were impossible to override, and that just didn't make sence.
|
|
|
|
|
Any member that you want to override has to be virtual (Overridable in VB). If you add a new implementation for a member that is not virtual, you will be shadowing the member instead.
Experience is the sum of all the mistakes you have done.
|
|
|
|
|
|
Hi,
Sorry to say but I am not very clear about the issue you are facing. I would like to confirm whether you are using Mnemonics as short keys. If yes, then I would like to mention that Mnemonics gets activated when we press the Alt+ (underlined character). For example if you have defined the caption (Text) of a Button as “Click Me” (note the underlined C here). The button will be clicked automatically when user presses Alt+C.
If this is the behavior you are facing then please know that it is a default behavior.
I hope this helps. Please let me know if I have missed something.
Regards,
John Adams
ComponentOne LLC
|
|
|
|
|
You got my point. Thank you so much for reply. This is possible by small setting in system.
The option given works.
|
|
|
|
|
This is a system setting and has nothing to do with your code.
Right-click a blank area on your desktop and pick Properties. On Windows 2000, under the Effects tab, you'll find "Hide keyboard navigation idicators until I press the Alt key". For Windows XP, it's under the Appearance tab, Effects button.
|
|
|
|
|
Hi guys.
I have the script of a stored procedure in a .txt file. I need to search for
a particular word in the file and add a line with information above that word.
The file contains this information:
CREATE PROCEDURE SalesByCategory<br />
@CategoryName nvarchar(15), @OrdYear nvarchar(4) = '1998'<br />
AS ---------------WORD TO SEARCH---------------<br />
IF @OrdYear != '1996' AND @OrdYear != '1997' AND @OrdYear != '1998' <br />
BEGIN<br />
SELECT @OrdYear = '1998'<br />
END<br />
<br />
SELECT ProductName,<br />
TotalPurchase=ROUND(SUM(CONVERT(decimal(14,2), OD.Quantity * (1-OD.Discount) * OD.UnitPrice)), 0)<br />
FROM [Order Details] OD, Orders O, Products P, Categories C<br />
WHERE OD.OrderID = O.OrderID <br />
AND OD.ProductID = P.ProductID <br />
AND P.CategoryID = C.CategoryID<br />
AND C.CategoryName = @CategoryName<br />
AND SUBSTRING(CONVERT(nvarchar(22), O.OrderDate, 111), 1, 4) = @OrdYear<br />
GROUP BY ProductName<br />
ORDER BY ProductName
I need to search for the AS word or the AS clause, you know the one that is after the parameters definition.
Once i have found that word i need to add the WITH ENCRYPTION clause above the AS CLAUSE, then the script would
look like this:
CREATE PROCEDURE SalesByCategory<br />
@CategoryName nvarchar(15), @OrdYear nvarchar(4) = '1998'<br />
WITH ENCRYPTION ---------------ADDED WORD---------------<br />
AS ---------------WORD SEARCHED---------------<br />
IF @OrdYear != '1996' AND @OrdYear != '1997' AND @OrdYear != '1998' <br />
BEGIN<br />
SELECT @OrdYear = '1998'<br />
END<br />
<br />
SELECT ProductName,<br />
TotalPurchase=ROUND(SUM(CONVERT(decimal(14,2), OD.Quantity * (1-OD.Discount) * OD.UnitPrice)), 0)<br />
FROM [Order Details] OD, Orders O, Products P, Categories C<br />
WHERE OD.OrderID = O.OrderID <br />
AND OD.ProductID = P.ProductID <br />
AND P.CategoryID = C.CategoryID<br />
AND C.CategoryName = @CategoryName<br />
AND SUBSTRING(CONVERT(nvarchar(22), O.OrderDate, 111), 1, 4) = @OrdYear<br />
GROUP BY ProductName<br />
ORDER BY ProductName
So...what i need to do is searching a word in the text file and then add a line above that word.
I have some ideas in my mind but i would like to know your opinions about how i could solve this.
Thanks for your time and regards...
Henry de Sousa
modified on Monday, January 21, 2008 8:56:05 PM
|
|
|
|
|
Use the Replace command in VB for example
<br />
Replace(mySQL, ControlChars.CrLf & "AS ", ControlChars.CrLf & "WITH ENCRYPTION AS ")<br />
Steve Jowett
-------------------------
Sometimes a man who deserves to be looked down upon because he is a fool, is only despised only because he is an 'I.T. Consultant'
|
|
|
|
|
Thanks for your help!!
I'll post the code when i have all my code done.
Henry de Sousa
|
|
|
|
|
Hello,
I have been trying to get the contents of a registry entry. I tried the following:
'http://www.andreavb.com/tip080001.html
Private Declare Function RegOpenKeyEx Lib "advapi32.dll" Alias "RegOpenKeyExA" (ByVal hKey As Long, _
ByVal lpSubKey As String, ByVal ulOptions As Long, ByVal samDesired As Long, phkResult As Long _
) As Long
'http:
Private Declare Function RegQueryValueEx Lib "advapi32.dll" Alias "RegQueryValueExA" ( _
ByVal hKey As Long, ByVal lpValueName As String, ByVal lpReserved As Long, _
lpType As Long, lpData As Any, lpcbData As Long) As Long
Private Sub Form_Load()
RegOpenKeyEx HKEY_LOCAL_MACHINE, "SOFTWARE\Microsoft\Windows\CurrentVersion", _
0&, KEY_READ, hKey
RegQueryValueEx hKey, "CommonFilesDir", 0, 0, sValue, iTemp
End Sub
After the RegOpenKeyEx is executed, hKey has a value of 0. Something doesn't seem right here. Can anyone help?
Regards,
Mike
modified on Tuesday, January 22, 2008 9:37:31 AM
|
|
|
|
|
I changed Form_Load as shown below:
Private Sub Form_Load()
HKEY_LOCAL_MACHINE = &H80000002
KEY_READ = &H20019
RegOpenKeyEx HKEY_LOCAL_MACHINE, "SOFTWARE\Microsoft\Windows\CurrentVersion", _
0&, KEY_READ, hKey
RegQueryValueEx hKey, "CommonFilesDir", 0, 0, sValue, iTemp
End Sub Now, I'm getting a non-zero value for hKey, but still I'm getting nothing for sValue. Anyone have any ideas?
Regards,
Mike
modified on Tuesday, January 22, 2008 10:49:23 AM
|
|
|
|
|