4 Replies - 2301 Views - Last Post: 02 March 2010 - 10:13 AM Rate Topic: -----

#1 Essel  Icon User is offline

  • D.I.C Head

Reputation: 5
  • View blog
  • Posts: 118
  • Joined: 08-May 09

If Else Statement

Post icon  Posted 26 November 2009 - 06:02 PM

I am having this problem with my combo box.I dont want users to select any of the items F,F9 and 6 with the combo box so i am using this code to check that and if a user selects any of them, it should give him/her a message and then disable the save button unless he/she changes the Letter before it enables it ...........This only works for the disabling but not for enabling even if the text is chaged
If Me.cmbgrade.Text = "F" Or Me.cmbgrade.Text = "F9" Or Me.cmbgrade.Text = "6" Then

			MessageBox.Show("Please You Can Register An Applicant With A Fail Among Six Subjects", "Admission Process", MessageBoxButtons.OK, MessageBoxIcon.Stop, MessageBoxDefaultButton.Button3)
			If Windows.Forms.DialogResult.OK Then
				Me.btnsave.Enabled = False
			Else
				Me.btnsave.Enabled = True

			End If
		End If



Is This A Good Question/Topic? 0
  • +

Replies To: If Else Statement

#2 mark.bottomley  Icon User is offline

  • D.I.C Addict
  • member icon

Reputation: 176
  • View blog
  • Posts: 990
  • Joined: 22-April 09

Re: If Else Statement

Posted 26 November 2009 - 06:22 PM

I suspect that it is because you are not collecting the result from the MessageBox.Show. This code is cut from the MSDN documentation.
Dim returnValue As DialogResult

returnValue = MessageBox.Show(text, caption, _
	buttons, icon, defaultButton)


then you need
If returnValue = Windows.Forms.DialogResult.OK Then
...


Was This Post Helpful? 0
  • +
  • -

#3 Guest_elish*


Reputation:

Re: If Else Statement

Posted 01 March 2010 - 08:21 AM

how do i connect forms through combo box?for example:

i am to log in and im in the admin's account, i have to select through the combox the admins account then log in...

how do i connect it to the admin's form?
Was This Post Helpful? 0

#4 AlbuquerqueApache  Icon User is offline

  • D.I.C Addict

Reputation: 49
  • View blog
  • Posts: 523
  • Joined: 21-February 10

Re: If Else Statement

Posted 02 March 2010 - 07:55 AM

View Postelish, on 01 March 2010 - 07:21 AM, said:

how do i connect forms through combo box?for example:

i am to log in and im in the admin's account, i have to select through the combox the admins account then log in...

how do i connect it to the admin's form?


You just use the namespace of your other form. For example: AdminsForm.textbox.text. Is that what you are asking?
Was This Post Helpful? 0
  • +
  • -

#5 CharlieMay  Icon User is offline

  • This space intentionally left blank
  • member icon

Reputation: 1623
  • View blog
  • Posts: 5,200
  • Joined: 25-September 09

Re: If Else Statement

Posted 02 March 2010 - 10:13 AM

You will have to determine from the combobox which login is being performed and then inside an if statement, show the appropriate form.
something like

If cboBox.Text = "Admin" then
  dim fAdmin as new frmAdmin
  fadmin.show
else
  dim fUser as new frmUser
  fUser.show
end if


Note: the code above is assuming form names and dis-regarding any other qualifications such as passwords. It is intended to show the basic If statement that I was referring to.

This post has been edited by CharlieMay: 02 March 2010 - 10:14 AM

Was This Post Helpful? 0
  • +
  • -

Page 1 of 1