I am used to using vb.net and trying to convert a vb.net application to C# and not having the greatest of luck when I am trying to reference fields that are named per hour sun10, sun11,sun12 etc... i want to loop through and set eachs propertys but can't figure out how i can achieve this.
here is what i have been trying to use.
here is what i have been trying to use.
C#:
while (tempcnt < hourblocks)
{
lasthr = (currhr + hrcntadd);
string suntemp = "sun" + (tempcnt + 10);
string montemp = "mon" + (tempcnt + 10);
string tuetemp = "tue" + (tempcnt + 10);
string wedtemp = "wed" + (tempcnt + 10);
string thutemp = "thu" + (tempcnt + 10);
string fritemp = "fri" + (tempcnt + 10);
string sattemp = "sat" + (tempcnt + 10);
if (sunhours[tempcnt] == 0)
{
suntemp.visible = false;
}
else
{
switch (Math.Round((sunhours[tempcnt] / weekcnt) / passhblock, 0))
{
case when < 1:
"sun" + tempcnt + 10.visible = true;
suntemp.text = Math.Round(sunhours[tempcnt] / weekcnt, 0);
suntemp.BackColor = System.Drawing.ColorTranslator.FromHtml("#FFFFFF");
break;
case 1:
suntemp.visible = true;
suntemp.text = Math.Round(sunhours[tempcnt] / weekcnt, 0);
suntemp.BackColor = System.Drawing.ColorTranslator.FromHtml("#FFFFCC");
Last edited by a moderator: