1.

Solve : c# help?

Answer»

in C#
 I have a file that has Button name on one line next line is what i want the button to do and the third line has a true or false value on wether to create the button or not. The file is populated from a grid view that part works fine the button name works fine but i cant get the button click to read to work or the true false can anybody HELP
text file looks like this
 Mahjong
 C:\Program Files\Microsoft Games\Mahjong\Mahjong.exe
 TRUE
 Chess
 C:\Program Files\Microsoft Games\Chess\Chess.exe
 TRUE
 FreeCell
 C:\Program Files\Microsoft Games\FreeCell\FreeCell.exe
 TRUE
 MineSweeper
 C:\Program Files\Microsoft Games\Minesweeper\MineSweeper.exe
 TRUE
 PurblePlace
 C:\Program Files\Microsoft Games\Purble Place\PurblePlace.exe
 TRUE
 
code for button array looks like this
var lineCount = File.ReadAllLines("C:\\ToucheDesktopApplicationFil es\\LoadApplications.txt").Length;
 _applicationButtonCount = (lineCount / 3);
 _ApplicationButton = NEW RadButton[_applicationButtonCount];
 for (int x = 0; x < _applicationButtonCount; x++)
 {
 _ApplicationButton

  • = new Telerik.WinControls.UI.RadButton();

 _ApplicationButton
  • .Name = "But_Application";

 _ApplicationButton
  • .Font = new Font("Segoe", 12);

 _ApplicationButton
  • .Size = new System.Drawing.Size(453, 49);

 _ApplicationButton
  • .Location = new System.Drawing.Point(1, 60 + x * 60);

 _ApplicationButton
  • .ImageIndex = x;

 }
 USING (sr)
 {
 for (int x = 0; x < lineCount / 3; x++)
 {
 _ApplicationButton
  • .Text = (sr.ReadLine());

 sr.ReadLine();
 sr.ReadLine();
 }
 } adding a handler for the click event of the button would be a good start...


Discussion

No Comment Found