Function Button_Click()
{
Param([Parameter(Mandatory=$True)]
$telephone,
$calledtoSee,
$wantstoSeeyou,
$pleaseCall,
$willcallAgain,
$returningYourCall,
$ToSelection,
$from,
$telephoneNumber,
$message)
$comboBoxSectionText = $ToSelection.GetItemText($ToSelection.SelectedItem)
if($comboBoxSectionText -eq "Please Select Contact"){
[System.Windows.Forms.MessageBox]::Show("Please Select Recipient")
}
if([string]::IsNullOrWhiteSpace($from.Text)){
[System.Windows.Forms.MessageBox]::Show("Please Enter Who The Message is From")
}
if([string]::IsNullOrWhiteSpace($telephoneNumber.Text)){
[System.Windows.Forms.MessageBox]::Show("Please Enter Telephone Number")
}
#########################################################################################################
<#
if([string]::IsNullOrWhiteSpace($from.Text)){
}
#>
[System.Windows.Forms.MessageBox]::Show("OutSide of IF")
[string]$radioSelectedText
[string]$comboBoxSectionText
[string]$persontoEmail
$date = ("Date " + $dateView.Day + "/" + $dateView.Month + "/" + $dateView.Year)
$time=("Time " + $dateView.ToShortTimeString())
}
I have the following form with 3 textboxes, 6 radio buttons, and a rich textbox. My issue is structuring my if statements to check if the text is blank, and if a radio button is selected.
Do I do numerous if statements, or nested if statements, checking each parameter before I do anything else?
I want if a textbox is blank or a radio button isn't selected, the program cannot continue, as in, prompts the user for what's missing, the user clicks okay, and fixes what is necessary and then continues. If any parameter is blank, it doesn't create the object. Until all parameters are filled, then the object gets created.
How do I achieve this?
Aucun commentaire:
Enregistrer un commentaire