|
i first wrote the code for the service in a simple windows app to test it and it worked fine and then copied it over to the service. in the app the code was run when a button was clicked. in the service the the code is run in OnStart.
|
|
|
|
|
There's you're problem. You cannot do that. OnStart is expected to return control back to the Service Manager within 30 seconds. Your code won't do that.
You MUST start a new thread that your service code runs under so the OnStart method can return control back to the Service Manager. This is going to require you to rewrite your code for a threaded environment.
|
|
|
|
|
I have a problem on the below random codes. The codes are actually working. But sometime it just hang after clicked on the randomise button. (I suspect it kept looping at (while loop) to search for random number. Can it be??)Can anyone help me? Here are my codes.
Private oQuestionCount As Integer = 5
Private sQuestionCount As Integer = 2
Dim tQuestion As Integer = ds.Tables("FilteredQuestion").Rows.Count
Dim aSize As Integer
If Me.cbQuesType.Text = "Obj" Then
aSize = oQuestionCount
Else
aSize = sQuestionCount
End If
If tQuestion = 0 And tQuestion < aSize Then
MessageBox.Show("The questions from the Question Bank is not enough")
Me.Dispose()
End If
Dim rnd = New Random
Dim irnd As Integer
Dim arnd(aSize - 1) As Integer
Dim aID(aSize - 1) As Integer
Dim i As Integer
Dim sID As String
Dim iStudentCount As Integer
Randomize()
For i = 0 To aSize - 1
irnd = rnd.Next(0, tQuestion - 1)
Do While Array.IndexOf(arnd, irnd) > -1
irnd = rnd.next(0, aSize - 1)
Loop
arnd(i) = irnd
aID(i) = ds.Tables("FilteredQuestion").Rows(irnd)(0)
If i = aSize - 1 Then
sID = sID & aID(i)
Else
sID = sID & aID(i) & ","
End If
Next
Thanks ....
|
|
|
|
|
Your name is not an intelligent subject, please try to choose one that makes sense. It helps people know if they can help you.
This looks like a mess. What are you trying to do ? Have you tried breaking into your code when it hangs to see what is going wrong ?
Christian Graus - Microsoft MVP - C++
"I am working on a project that will convert a FORTRAN code to corresponding C++ code.I am not aware of FORTRAN syntax" ( spotted in the C++/CLI forum )
|
|
|
|
|
Hi Christian Graus,
Thanks for the comment on the subject. I had changed it.
Yes, i tried to break the code and found out that it kept looping in the (while loop) to search for numbers i guess.
Actually what i'm trying to do is to retrieve random question from a table. This is a exam. paper program. So the student will login their ID to sit for exam. This program is to retrieve random question so that every student will not get the same quetion. This is my first time writing code for randomise. No idea what went wrong. Can you advice me? thanks in advance.
|
|
|
|
|
Hi.
I opened a VB .NET project with Visual Studio 2005. I have had limited contact with VB in the past and I'm not very comfortable using it.
My question:
Doesn't VS 2005 have a refractor for VB .NET??
I wanted to rename a method with (CTRL+R,R) just like I do in C# and VS says "The key combination (CTRL+R,R) is bound to a command(&Rename) which is not currently available".
And the menu Refractor, which in C# is between "View" and "Project" doesn't exist as well...
|
|
|
|
|
The keyboard shortcuts are probably different, but refactor should be on the right click menu ?
Christian Graus - Microsoft MVP - C++
"I am working on a project that will convert a FORTRAN code to corresponding C++ code.I am not aware of FORTRAN syntax" ( spotted in the C++/CLI forum )
|
|
|
|
|
As opposed to C#, where there's the Refractor group with "Rename", "Extract method", etc, in VB there's only a single option called Rename, which brings up a "Rename" dialog. But it is simpler than the standard one of Refractor, more precisely it doesn't have any options (preview, search in comments & search in strings)
|
|
|
|
|
hai to all
i am working only vb .net,i val;i validate the text box only numbers & Only characters,so not support the platform keypress event and click event,pls give me a solution
Rathi
|
|
|
|
|
Ursrathi wrote: so not support the platform keypress event and click event,pls give me a solution
I don't understand ? The Textbox DOES support the keypress event.
Christian Graus - Microsoft MVP - C++
"I am working on a project that will convert a FORTRAN code to corresponding C++ code.I am not aware of FORTRAN syntax" ( spotted in the C++/CLI forum )
|
|
|
|
|
I have checked the events of TextBox. It does support KeyPress event. Can you recheck at your end.
You can use the following code for validation on a TextBox.
<br />
Private Sub TextBox1_KeyPress(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyPressEventArgs) Handles TextBox1.KeyPress<br />
<br />
Select Case (Asc(e.KeyChar))<br />
<br />
Case 8, 48 To 57, 65 To 91, 96 To 122<br />
<br />
e.Handled = False<br />
<br />
Case Else<br />
<br />
e.Handled = True<br />
<br />
End Select<br />
<br />
End Sub<br />
Allen Smith
Software Engineer
ComponentOne LLC
www.componentone.com
|
|
|
|
|
Gosh, that's nasty. I use stuff like Char.IsControl, Char.IsDigit and Char.IsAlpha to write this sort of code.
Christian Graus - Microsoft MVP - C++
"I am working on a project that will convert a FORTRAN code to corresponding C++ code.I am not aware of FORTRAN syntax" ( spotted in the C++/CLI forum )
|
|
|
|
|
Why dont u use mask edit box to solve ur issue???
|
|
|
|
|
how to make search button in the vb 2005?
jack
|
|
|
|
|
Easy - put a button on the form and write code to search. For more help, give more details.
Christian Graus - Microsoft MVP - C++
"I am working on a project that will convert a FORTRAN code to corresponding C++ code.I am not aware of FORTRAN syntax" ( spotted in the C++/CLI forum )
|
|
|
|
|
i'm looking for how to use for...next loop for my project
i want to use that coding for the how many months left when the user pay the payment on my system
jack
|
|
|
|
|
A for next loop is a very basic C# construct. Buy a book and work through it if you don't know this stuff.
Christian Graus - Microsoft MVP - C++
"I am working on a project that will convert a FORTRAN code to corresponding C++ code.I am not aware of FORTRAN syntax" ( spotted in the C++/CLI forum )
|
|
|
|
|
Dim i As Integer = 0
Dim dt_result As New DataTable
For i = 0 To dt_result.Rows.Count - 1 Step 1
'Here ur coding
Next
Janani
|
|
|
|
|
Add a row: (consider that your listview has 2 columns)
Dim item as new listviewitem("new row")
item.subitems.add("new row's column 2")
Listview1.items.Add(item)
Edit the row, you enumerate through the list or get the selected row
Dim item as ListViewItem = ListView1.SelectedItem(0)
item.Text = "new row modified"
item.subitems(1).Text = "new row's column 2 modified"
That should be it...
|
|
|
|
|
Hi
I have a program which collects performance counters from any system on a network - the problem is, it works fine if the native OS is English, but refuses to collect any counter in any other language OS (German, for example). Anybody else faced this issue? Any suggestions?
Thanks for your help
Chandra Ram
|
|
|
|
|
The counter names would be localised so you need to adjust the name of the counter you are opening according to the locale setting.
|
|
|
|
|
Duncan Edwards Jones wrote: The counter names would be localised so you need to adjust the name of the counter you are opening according to the locale setting.
Thank you for your time... but isn't there some way whereby one could map each counter name across languages? What if I am collecting counters based on a pre-defined set (unfortunately, the list is in English)?
I remember vaguely that there is a TranslateName or some such function available to do this...
Any insights welcome.
Chandra
|
|
|
|
|
hi everyone,
how can i determine whether particular Exe is in memory or not ?in my application i want to execute some statement if all contents of exe is fully eliminate from memory ?
Thanks in advance
Rupesh Kumar Swami
Software Engineer,
Integrated Solution,
Bikaner (India)
My Company
|
|
|
|
|
You can use the Process clas and it's GetProcessesByName method to do this.
|
|
|
|
|
i have a datagridview im my application and i would like to print its content..i already have a printdocument component in my form but i don't know which method to use in order to print all the contents in my datagridview..
pls help...
tnx
gt
|
|
|
|