-1
私のファイルからテキストボックスにすべての真の文を出力しようとしています。何らかの理由で1行しか表示されません。私は間違いや括弧を見逃すことができません。すべての文から1行だけをテキストボックスに出力c#
私はラジオボタンを持っていて、ドキュメントに印刷するための変数を割り当てています。これは動作しています。私は.toString()を使用しました。私は文字列をintに変更できないというエラーが出ていたので、これをtxtboxに要約して表示しようとしていました。
`
//if radio button is checked write to file
if (rdoIndoor.Checked == true)
{
rdoIndoor.Text = iIndoor.ToString();
sw.WriteLine(rdoIndoor.Text);
}
else
{
rdoOutdoor.Text = iOutdoor.ToString();
sw.WriteLine(rdoOutdoor.Text);
}
//if radio button is checked write to file
if (rdoFree.Checked == true)
{
rdoFree.Text = iFree.ToString();
sw.WriteLine(rdoFree.Text);
}
else
{
rdoPriced.Text = iPriced.ToString();
sw.WriteLine(rdoPriced.Text);
}
コード:
txtSummary.Text = "Music events were most popular this year" + Environment.NewLine;
}
else
{
txtSummary.Text = "Theatre events were most popular this year" + Environment.NewLine;
}
//find out if free or pri string line = string.Empty;
while ((line = sr.ReadLine()) != null)
{
for (int iCount = 0; iCount < sMonths.Length; iCount++)
{
//conditions
if (iCount == 2)
{
sMonths[iCount] = sr.ReadLine();
//find out which type of event was more popular within the year
if (iCountDance > iCountArt && iCountDance > iCountMusic && iCountDance > iCountTheatre)
{
txtSummary.Text = "Dance events were most popular this year" + Environment.NewLine;
}
else if (iCountArt > iCountDance && iCountArt > iCountMusic && iCountArt > iCountTheatre)
{
txtSummary.Text = "Art events were most popular this year" + Environment.NewLine;
}
else if (iCountMusic > iCountDance && iCountMusic > iCountArt && iCountMusic > iCountTheatre)
{ced events were more popular this year
if (iPriced > iFree)
{
txtSummary.Text = "Priced events were more popular this year" + Environment.NewLine;
}
else if (iFree > iPriced)
{
txtSummary.Text = "Free events were moree popular this year" + Environment.NewLine;
}
iAttendanceTotal = iAttendance * iAttendance;
txtSummary.Text = "At least " + iAttendanceTotal + " people attended events over the year" + Environment.NewLine;
}
テキストボックスのテキストファイルは問題ありませんか?しかし、テキストボックスへのファイルテキストはそうではありませんか? –
@ LP。 Gonçalvesはい、以前はファイルからリストボックスに取り掛かっていましたが、forループのためにループが繰り返されるため、テキストボックスに読み込むように変更しましたが、もう機能しません。 – Lorna