0

Method Bucle (C#)

I have this code:

17th May 2018, 4:03 AM
SebGM2018
SebGM2018 - avatar
4 Answers
0
I need to repeat this code into a loop: private void loadtask () {for (INT zero = 0; zero> = settings.default.counter; zero ++) {if (file.exists ("file.analy")) {xmlserializer xs = new xmlserializer (typeof (reminders.information)); filestream read = new filestream ("file.analy", filemode.open, fileaccess.read, fileshare.read); reminders.information info = (reminders.information) xs.deserialize (read); // createtask // taskpanel panel taskpanel = new panel (); taskpanel.size = new size (500, 500);
17th May 2018, 4:04 AM
SebGM2018
SebGM2018 - avatar
0
(2) // creating a new control, this will be the task visual GUI // task picturebox task = new picturebox (); task.size = new size (357, 446); task.sizemode = pictureboxsizemode.stretchimage; task.image = reminders.properties.resources.task2; point P. = new point (); INT postop = 12; point taskp = new point (); taskp.x = postop; taskp.y = 1; task.location = taskp; postop + = 300; task.click + = new eventhandler (task_click); // setting control properties // titlebox textbox titlebox = new textbox (); titlebox.name = "titlebox" + varcounter; titlebox.text = info.title1; point tp = new point (); tp.x = task.location.x + 40; tp.y = 45; titlebox.borderstyle = system.windows.forms.borderstyle.none;
17th May 2018, 4:05 AM
SebGM2018
SebGM2018 - avatar
0
(3) titlebox.size = new size (274, 45); titlebox.font = new font ("Helvetica Lt. STD", 27, fontstyle.bold); titlebox.location = tp; // datepicker datetimepicker datepicker = new datetimepicker (); datepicker.size = new size (126, 20); datepicker.value = info.date3; point DTP = new point (); dtp.x = titlebox.location.x + 1; dtp.y = 115; datepicker.location = DTP; datepicker.format = datetimepickerformat.custom; datetime now = datetime.now; // hourpicker datetimepicker hourpicker = new datetimepicker (); point HP = new point (); hourpicker.value = info.hour4; hp.x = dtp.x + 144; hp.y = dtp.y; hourpicker.size = new size (126, 20); hourpicker.format = datetimepickerformat.time; hourpicker.location = HP;
17th May 2018, 4:05 AM
SebGM2018
SebGM2018 - avatar
0
(Last) taskpanel.controls.add (titlebox); taskpanel.controls.add (descriptionbox); taskpanel.controls.add (datepicker); taskpanel.controls.add (hourpicker); taskpanel.controls.add (task); reminderpanel.controls.add (taskpanel); backgroundworker1.cancelasync (); // loadtask}}} what happens is that I want you to the output of this code is create several of these controls, but the problem is that not create or one. (without the loop lonely creates 1 and settings.default.counter it's = 2). in addition, in line if (file.exists ("file.analy")) {xmlserializer xs = new xmlserializer (typeof (reminders.information)); filestream read = new filestream ("file.analy", filemode.open, fileaccess.read, fileshare.read); reminders.information info = (reminders.information) xs.deserialize (read); It Reads information of a file and the sample, so should read other information file and so. thank you for your attention.
17th May 2018, 4:06 AM
SebGM2018
SebGM2018 - avatar