|
I would like to know on how to start an existing windows service programtically (using Visual Basic). After starting the service, I would also like to check the error code that it returns to verify that the service has indeed started.
Can I check a registry key to see of a specific windows service is currently running? If not, is there a programatic way to check if a specific windows service is currently running or not?
Thanks in advance
-- modified at 0:13 Wednesday 7th December, 2005
|
|
|
|
|
|
Thanks Dave.
This code is using the 'System' and 'ServiceControlManager' classes to work with the existing services. I am looking for Win32 API way of checking the status of the service. This is because, I want to use the Win32 API (Declare and code) in Lotus Notes (LotusScript). Generally, LotusScript can use Win32 API similar to a VB code where you DECLARE the Win 32 API function with the arguments and then call that function within the code.
Thanks
Ravi
|
|
|
|
|
Doing it the hard way?
A 10 second search on Google for "vb6 start stop service" revealed this example[^].
10 seconds is a lot quicker than 12 hours in a forum, isn't it?
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
Have anyone experience, delete key is not functioning on TextBox
So weir, on other forms TextBox is working fine.
Any comment?
|
|
|
|
|
I have an service that I developed that loads a COM library on startup. The application has been running on a machine for several months on a server, but on at least 3 occasions (on 2 different machines) I have recieved a "Cannot create ActiveX component" exception. In order to get the program to run I had to uninstall\reinstall the DLL. Apparently there is something that is happening were the registry entry for the library is either lost or corrupted (I suspect). Anyone have any ideas how I could work around this? The library is redistrubutable, maybe I could re-register it when I load the service? Any ideas would be appreciated, I'm at a loss why after a few months of operation all of a sudden I would be unable to load the library file.
Uptight Ex-Military Republican married to a Commie Lib - How weird is that?
|
|
|
|
|
i am currently having a problem in visual basic .net 2005, while trying to put comboboxes in a datagrid.
I am populating the datagrid with a database table. After i bind this data, i would like to change one of the cells to a combobox. Can someone help me out or point me in the right direction?
anything would be appreciated
|
|
|
|
|
Check this link out:
http://RustemSoft.com/DataGridColumns.htm
They have a pretty good one with examples.
|
|
|
|
|
thank you for the link, im going to look into it
|
|
|
|
|
i've got a form with 3 fields: comboBox, button(text = &Add) and a textBox.
Run the form, type, "abc" in the comboBox, highlight the "abc", click on the Add button and the eventcode shows a selectionlength of 0.
TextBox1.Text = cboBox.SelectionLength
go through the same process and type Alt A, instead of clicking the Add button, and the eventcode shows a selectionlength of 3.
the parameters for the 3 fields are default, visual basic.net, running in MDE 2003, version 7.1.3088.
i've also tried the other selection options, eg, selectedindex, and still get unexpected results.
thanks.
|
|
|
|
|
mattlove wrote: Run the form, type, "abc" in the comboBox, highlight the "abc", click on the Add button and the eventcode shows a selectionlength of 0.
TextBox1.Text = cboBox.SelectionLength
go through the same process and type Alt A, instead of clicking the Add button, and the eventcode shows a selectionlength of 3.
The reason for this is that when you click on the button, focus leaves the combobox, and nothing is selected anymore. Thus the "0". When you do an "Alt A", focus is still in the combobox, and you have three characters highlighted, you get a "3".
mattlove wrote: i've also tried the other selection options, eg, selectedindex, and still get unexpected results.
You don't say anything about adding items to the combobox items, so I am assuming that it is empty. Thus, regardless of clicking the button, or doing an "Alt A", you will probably get a "-1".
I guess my question would be: What do you want to happen?
Let's assume that you want the Add button to add the item to the combobox list. In the button click event, use this code:
CboBox.Items.Add(CboBox.Text)<br />
TextBox1.Text = CboBox.Items.Count
This will add what is typed in the combobox to the combobox list, and then put the number of items in the list into the textbox.
Hope this helps.
Roy.
-- modified at 12:28 Thursday 8th December, 2005
|
|
|
|
|
thanks roy.
my example should have been based on the delete function in which the difficulty is more acute than the add function...my fault.
what i want to do is highlight something in the comboBox and delete it using the delete button.
your answer helped me solve it but i have a question.
my solution is to use selectedindex which returns -1 if nothing is selected...working like a charm.
so, the reason selectedtext, selectedvalue, selectionlength and selectionstart don't work is because the field is out of focus, is that right? can you or do you want to recommend any other solutions i could use?
thank you very much in any case.
matt
|
|
|
|
|
You could try putting this in your Delete button handler:
If cboBox.SelectedIndex > -1 Then<br />
cboBox.Items.Remove(cboBox.SelectedItem)<br />
End If
This does not care if the item has focus or not.
Roy.
|
|
|
|
|
works like a charm
thanks again roy.
matt
|
|
|
|
|
How to set the text of a text box on a crystal report at run time?
Dim strEmpName As String
strEmpName = TextBox1.Text
Dim a As Form2
a = New Form2
Dim crReport As CrystalReport1
crReport = New CrystalReport1
Dim cr As CRAXDDRT20.TextObject
cr = crReport.Section1().ReportObjects.Item("Text3")
cr.SetText(strEmpName)
a.CrystalReportViewer1.ReportSource = crReport
a.Show()
Farah
|
|
|
|
|
this might help u....
add a parameter field in ur report.
than use the following code:-
Dim rpt As New myreport ''the report that u created
CrystalReportViewer1.ReportSource = rpt
rpt.SetParameterValue(0, textbox1.text.trim)
this should work it worked with mine..
abhinav
|
|
|
|
|
How to set the text of a text box on a crystal report at run time?
Dim strEmpName As String
strEmpName = TextBox1.Text
Dim a As Form2
a = New Form2
Dim crReport As CrystalReport1
crReport = New CrystalReport1
Dim cr As CRAXDDRT20.TextObject
cr = crReport.Section1().ReportObjects.Item("Text3")
cr.SetText(strEmpName)
a.CrystalReportViewer1.ReportSource = crReport
a.Show()
Farah
|
|
|
|
|
I need to create a empty sound wave file. I do it like this now.
System.IO.File.Create("test.wav")
This test file has zero bytes.
But the program I am using can't record to it. Says somthing like file type not recognized.
However if I use explorer and right click new - new wave sound, The program can record to it ok.
This one created by explorer has 1k bytes.
How can I programicly create a "formated?" wave file like explorer?
-- modified at 11:40 Tuesday 6th December, 2005
|
|
|
|
|
|
I would create a wav file in explorer and figure out what data is in it (by reading it into an array, for example). Then whenever you want to create a wav file, you just have to write out those bytes. You will probably want to bury the header bytes for a "blank" wav file as a resource in your application so you dont have to worry about keeping an empty file around that could get accidentally deleted.
|
|
|
|
|
Hey everyone, my name is Vik. I'm foreign young school student n i jus started learnin programing. I got 5 pictures to load in a picture box, "next" and "previous" button. Got no idea how i can implement it, can someone please give me a bit of help.
in old VB i could write path for a fil in this form "me:\pic\example.gif", it doesnt seem to work in VB.Net,can anyone tell me what is a way for doin this?
Thank u,
Vik
|
|
|
|
|
picturebox.Image = System.Drawing.Image.FromFile("C:\path\as\string.here")
Geronimo
|
|
|
|
|
Hi!
I have a created a windows service. Now I'm writing an application that monitors this service. I want the application to display a NotifyIcon in the system tray. Also I want the service to start the monitoring application if it's not already running.
If I start the application on it's own everything works fine. I can see and intercat with my icon, but if the service starts the application I can see the process running in the Task Manager but the system tray icon is missing.
Any ideas?
|
|
|
|
|
It's missing because the service started the monitoring application on the wrong desktop. Service run under their own desktop, not the one you see when you log in.
You might want to try going into the Service manager, getting properties on your service, click the LogOn tab, and check the box that says something like "Allow service to interact with desktop".
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
Yes, I guessed that it was something like that.
When the service is starting the monitoring application they both run as SYSTEM in the task manager. I've tried to set it to allow interaction with my desktop, as you proposed, with no result.
I also tried to allow the service to run as my user account. Now both the service and the monitoring application is running as my local user in the task manager but still no system tray icon?
|
|
|
|