Thanks for your reply. Actually, I do have the service automatically starting during the OS start-up using the method you described. What I want to do is have the service automatically started right after installation (without requiring a reboot). I was eventually able to accomplish this by putting the following code in the ProjectInstaller.vb file. The program "MyApp" is a console application that starts, stops, pauses, etc. the service using various command parameters (in this case, "/start,MyService"). 'Auto-start the service after installation. Dim psInfo As New System.Diagnostics.ProcessStartInfo("C:\Program Files\MyApp.exe", "/start,MyService") psInfo.WindowStyle = System.Diagnostics.ProcessWindowStyle.Hidden Dim myProcess As Process = System.Diagnostics.Process.Start(psInfo) Thanks, Todd_S
Todd_S
Posts
-
Windows Service Automatic Start -
Windows Service Automatic StartI am developing a windows service in VB .NET. I currently am using a START button on a windows form (separate application) to start the service. I would like to avoid having a separate application and, instead, have the service automatically start at installation. Does anyone know how I might accomplish this? Thanks for your time.
-
Datagrid Paging Button CountI was able to figure out what was going wrong. I was binding the datagrid every time the Page_Load event fired (at postback), instead of re-binding it on the PageIndexChanged event. I needed the following code in the Page_Load event: If Not Page.IsPostBack Then BindDataGrid() End If Also, I added the following code to the PageIndexChanged event: Dim dsReport As New DataSet Me.dgrdReport.CurrentPageIndex = e.NewPageIndex 'Re-bind the datagrid. dsReport = Session("dsReport") Me.dgrdReport.DataSource = dsReport.Tables("Report").DefaultView Me.dgrdReport.DataBind() Session("dsReport") = dsReport Thanks for your help. Sorry to take you on a tangent. But, it was helpful to discuss alternative methods for making this work.
-
Datagrid Paging Button CountThanks for your quick response. I did try something similar to this, but I could never get it to work properly. I will try your viewstate suggestion. I assume that I will also need to decrement the viewstate by 10, 20, 30 and so on whenever the back button is selected (that is, the "..." button that takes you to the previous set of 10 page buttons). One question, though ... where do I declare the viewstate = 0 initially? I can't have it in the page index change event. Thanks again.
-
Datagrid Paging Button CountI have a datagrid that is bound to a dataset. I am having a problem getting the default paging to work properly. The page navigation buttons work for the first set of 10 pages. After selecting the "..." button to access the next set of 10 page buttons, when I select a new page button (for example, page 16), it takes me back to page 7. It is not indexing the page count & assuming that every page button count list is 0-10. Essentially, I can't view anything beyond page 10. Incidently, I tried setting the PagerStyle Mode="NextPrev" and I couldn't get past page 2 even though I kept selecting the ">" button. Here are my settings: AllowPaging=True; PageSize=10; PagerStyle Mode="Numeric Pages"; and PageButtonCount=10 Here is my code for the page index change event: Private Sub dgrdReport_PageIndexChanged(ByVal source As Object, _ ByVal e As System.Web.UI.Webcontrols.DataGridPageChangedEventArgs) _ Handles dgrdReport.PageIndexChanged Me.dgrdReport.CurrentPageIndex = e.NewPageIndex Me.dgrdReport.DataBind() End Sub Any suggestions on this issue would be appreciated. I have been struggling with this for a while now. Thanks.