alrighty i am working on a VB project for Chem and im making it for converting grams to moles, moles to molecules or any thing like that. and i have about 110 elements set up and working fine the way that im doing it but i have a feeling this is a horrible way and to abundant.
i have a textbox set up to if i type in the element He and hit enter it will find ChemElement(1)= "He" and it calls
"Sub DisplayElement( ByVal number As Decimal, ByRef label2 As Label)"
Which then displays the Chemical mass into a Label.
so basically here is my code
now what my question is after we got all that settled is, is there a way to set this up so what ever is entered in my TextBox1 say element "B", that i could code it up to find ChemElement(4)= "B".
i ask for knowledge on arrays, and i have been doing some research on arrays but cannot seem to find any help. because this coding works that i have it is just very long and harsh.
thank you anyone for help.
-negus
i have a textbox set up to if i type in the element He and hit enter it will find ChemElement(1)= "He" and it calls
"Sub DisplayElement( ByVal number As Decimal, ByRef label2 As Label)"
Which then displays the Chemical mass into a Label.
so basically here is my code
Code:
If TextBox1.Text = ChemElement(0) Then Call DisplayElement(ChemMass(0), Me.Label2) ElseIf TextBox1.Text = ChemElement(1) Then Call DisplayElement(ChemMass(1), Me.Label2)
Code:
Sub DisplayElement(ByVal number As Decimal, ByRef label2 As Label) Labe2.text=number
i ask for knowledge on arrays, and i have been doing some research on arrays but cannot seem to find any help. because this coding works that i have it is just very long and harsh.
thank you anyone for help.
-negus
Comment