Welcome to Dream.In.Code
Getting VB.NET Help is Easy!

Join 107,663 VB.NET Programmers for FREE! Ask your question and get quick answers from experts. There are 1,058 online right now! We've got more than 500 tutorials and 2,000 snippets. Join and find out why Dream.In.Code is the #1 programming help community on the internet! Registration is fast and FREE... Join Now!



Use checkboxes as options in command

 
Reply to this topicStart new topic

Use checkboxes as options in command, I am trying to send flexible options to a command.

tuxmeister
post 30 Jun, 2008 - 04:46 PM
Post #1


New D.I.C Head

*
Joined: 25 Jun, 2008
Posts: 15



Thanked 1 times
My Contributions


Guys, I am working on an interface for a commandline tool that we have at work used to perform Windows profile refreshes. A part of the options that you put in the command are static such as the user ID, server name and printers but the hard part is the tokens. Those tokens are within the full user name field.

I need to find out how to put those tokens there only if they are checked with a checkbox. If they're not checked, nothing should appear in the final string.

Here is the code that I have so far, declaring all the string variables that I need:

CODE

Public Class Prof_refresh

    Private Sub Close_btn_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Close_btn.Click
        Me.Close()
    End Sub

    Private Sub Prof_refresh_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
    End Sub
    Private Sub radioButtons_CheckedChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) _
    Handles Radio_Full.CheckedChanged, Radio_Partial.CheckedChanged
        If Radio_Full.Checked = True Then Me.Refresh_type_box.Text = "ref" '<-hidden textbox
        If Radio_Partial.Checked = True Then Me.Refresh_type_box.Text = "refp" '<-hidden textbox
    End Sub
    '\\Declaration of the tokens and passing text to boxes - THIS IS WHAT I NEED TO BE FLEXIBLE
    Private Sub checkButtons_CheckChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) _
    Handles No_ACL.CheckedChanged, No_SNA.CheckedChanged, Save_Set.CheckedChanged, OVR.CheckedChanged
        If No_ACL.Checked = True Then Me.No_ACL_Text.Text = "noacl" '<-hidden textbox
        If No_SNA.Checked = True Then Me.No_SNA_Text.Text = "nosna" '<-hidden textbox
        If Save_Set.Checked = True Then Me.Save_Set_Text.Text = "saveset1" '<-hidden textbox
        If OVR.Checked = True Then Me.OVR_Text.Text = "ovr" '<-hidden textbox
    End Sub

    Private Sub Run_btn_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Run_btn.Click
        Me.Size = New System.Drawing.Size(604, 600)
        ProfileRefresh()
    End Sub
    Public Function ProfileRefresh() As Boolean
        Dim RefreshTypeVar As String = Me.Refresh_type_box.Text
        Dim RefreshUserID As String = Me.UserID_text.Text
        Dim RefreshServer As String = Me.Server_text.Text
        Dim RefreshSrvInst As String = Me.Instance_text.Text
        Dim RefreshUserName As String = Me.FullUserName.Text
        Dim BWPrinters As String = Me.BW_printer.Text
        Dim CLPrinters As String = Me.Color_printer.Text
        Dim DefaultBW As String = Me.Defo_prnt.Text
        Dim ProfRefreshProcess As New Process()
        Dim ProfRefreshStartInfo As New ProcessStartInfo()
        ProfRefreshStartInfo.FileName = "cmd.exe "
        ProfRefreshStartInfo.WorkingDirectory = "C:\useradm\cut31"
        'ProfRefreshStartInfo.UseShellExecute = False
        'ProfRefreshStartInfo.CreateNoWindow = True
        '\\Declaration of the command with all the options
        ProfRefreshStartInfo.Arguments = "/D /c useradm.cmd " + RefreshTypeVar + " " + RefreshUserID + " " + RefreshServer + " " _
        + RefreshSrvInst + " " + """" + RefreshUserName + "{" 'here I should start to put the tokens <-
        ProfRefreshProcess.EnableRaisingEvents = True
        ProfRefreshProcess.StartInfo = ProfRefreshStartInfo
        ProfRefreshProcess.Start()
    End Function
End Class


Also, when the command is launched, I would like to send it's output to a multi-line textbox that is hidden until you press the "RUN!" button.

Anybody would want to help?

Thanks! rolleyes.gif

This post has been edited by tuxmeister: 30 Jun, 2008 - 06:25 PM
User is offlineProfile CardPM

Go to the top of the page

Fast ReplyReply to this topicStart new topic
Time is now: 8/29/08 10:34PM

Live VB.NET Help!

VB.NET Tutorials

Reference Sheets

VB.NET Snippets

Bye Bye Ads

Free DIC T-Shirt

T-Shirt Example

Related Sites

Monthly Drawing

Thumb Drive

Partners

Top Contributors

Top 10 Kudos This Month