rlblair13090
New member
- Joined
- Sep 11, 2020
- Messages
- 1
- Programming Experience
- 3-5
this is a subset out of the code. i want to be able to save values from inside a loop
so i = 1 etc
i used words for my get set
what i have is a variable that is the equivalent of the string "One"
as in
string sTextAnswer = "One"
But when i try to set a value
vFixIDHex.sTextAnswer =
it wont work
i need
vFixIDHex.One
is there a way to do a
vFixIDHex.(value of sTextAnswer)
I think i wrote myself into a corner
so i = 1 etc
i used words for my get set
what i have is a variable that is the equivalent of the string "One"
as in
string sTextAnswer = "One"
But when i try to set a value
vFixIDHex.sTextAnswer =
it wont work
i need
vFixIDHex.One
is there a way to do a
vFixIDHex.(value of sTextAnswer)
I think i wrote myself into a corner
C#:
public static string IntToString(double amount)
{
var n = (int)amount;
var arr = new string[] { "One", "Two", "Three", "Four", "Five", "Six", "Seven", "Eight", "Nine" };
return arr[n - 1];
}
class vFixIDHex
{
public string One { get; set; }
public string Two { get; set; }
public string Three { get; set; }
public string Four { get; set; }
public string Five { get; set; }
public string Six { get; set; }
public string Seven { get; set; }
public string Eight { get; set; }
public string Nine { get; set; }
}
private void BtnStart_Click(object sender, EventArgs e)
{
vFixIDHex IdHx = new vFixIDHex();
int iNumfromBox = Convert.ToInt32(Math.Round(BxNumUpDwn.Value, 0));
string sTextAnswer = IntToString(iNumfromBox);
TxtBxWordEquiv.Text = sTextAnswer;
vFixIDHex.sTextAnswer = "It Actually worked";
Last edited by a moderator: