Ruud Hermans Posted December 30, 2008 Share Posted December 30, 2008 I can't figure this out. It tells me "Man" and "Vrouw" are not declared but those are the values from the ComboBox1. I have searched the internet looking for the answer but I can't find it anywhere. Sure there should be more easy way's for the entire thing but I am still in the beginningstage of learning. So if possible build on from this and hopefully some one is able of telling me what is wrong. Public Class Form1 Private Sub ComboBox1_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ComboBox1.SelectedIndexChanged End Sub Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click Dim leeftijd, lengte, gewicht, AL, BMR, BMR1, BMR2, BMR3, BMR4, BMR5, BMR6, onderhoud, eiwitten As Integer Dim geslacht As String geslacht = ComboBox1.Text lengte = TextBox1.Text gewicht = TextBox2.Text AL = ComboBox2.Text leeftijd = TextBox6.Text BMR1 = gewicht * 13.7 BMR2 = lengte * 5 BMR3 = leeftijd * 6.8 BMR4 = gewicht * 9.6 BMR5 = lengte * 1.8 BMR6 = leeftijd * 4.7 If geslacht = Man Then BMR = 66 + BMR1 + BMR2 + BMR3 ElseIf geslacht = Vrouw Then BMR = 655 + BMR4 + BMR5 + BMR6 Else MsgBox("Geen ingave geslacht.") End If TextBox3.Text = BMR End SubEnd Class Link to comment Share on other sites More sharing options...
Synook Posted December 31, 2008 Share Posted December 31, 2008 If the "Man" and Vrouw" are values, then don't you want to put them in quotation marks? Link to comment Share on other sites More sharing options...
zppblood Posted January 2, 2009 Share Posted January 2, 2009 Like Synook said, place quotation marks around them to make them values otherwise it might think you are trying to use a variable or constant, and that just means to set the type of data you are using for the variable or constant and the value you assigned to it. Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.