5/23/2023 0 Comments Edit listview subitem in vb6 diet![]() ![]() ![]() Not a good practice and it can lead to some unpredictable results. Next, you are doing all of your work on the UI thread and then trying to make the system responsive with DoEvents. If your code does have a bug, you wouldn't know about it because you would never see the exceptions. You are ignoring any exceptions that are thrown. If you have a Try Catch block, you should catch the exception and do something with it. There is a lot here that needs to be addressed and it wouldn't surprise to find out that the problem is solved by solving some of these other problems.įirst, you are eating all of your exceptions. but I only want when I click the button it will just stop the service(s) one time only. ![]() The above code will stop the selected service(s) on a listview(checkbox = true)īut when I select the 'stop' button it will stop and stop the services again and again. MessageBox.Show( " Please select service(s) do you want to end", " Information", MessageBoxButtons.OK, MessageBoxIcon.Asterisk) MessageBox.Show( " The service(s) can't be stop", " Information", MessageBoxButtons.OK, MessageBoxIcon.Asterisk) MessageBox.Show( " The service(s) status stopped", " Information", MessageBoxButtons.OK, MessageBoxIcon.Asterisk) If (services(i).Status.ToString = " Stopped") Then Try Dim services As ServiceController() = ServiceController.GetServicesĭim i As Integer For i = 0 To services.Length - 1 Try Do While (item.Text = services(i).ServiceName.Trim) Dim flag As Boolean = False Dim item As ListViewItemįor Each item In Me.ListViewServices.CheckedItems
0 Comments
Leave a Reply. |