Search
Search titles only
By:
Search titles only
By:
Log in
Register
Search
Search titles only
By:
Search titles only
By:
Menu
Install the app
Install
Forums
New posts
All threads
Latest threads
New posts
Trending threads
Trending
Search forums
What's new
New posts
New ads
New profile posts
Latest activity
Free Ads
Latest reviews
Search ads
Members
Current visitors
New profile posts
Search profile posts
Contact us
Latest ads
Power Lifting Lever Belt
SkullVamp
Updated:
Saturday at 10:32 PM
Ad icon
port.lk Domain for sale
Lankan-Tech
Updated:
Saturday at 3:55 PM
Colombo
Kaduwela - Two Storey House for Sale
dilrasan
Updated:
Jun 11, 2026
Ad icon
Wechat qr verification
Pawan2005
Updated:
Jun 11, 2026
🚀 GOOGLE AI PRO 18 MONTHS ACTIVATION 🚀
sayuru bandara
Updated:
Jun 10, 2026
Electronics
Vehicles
Property
Search
Reply to thread
Forums
General
ElaKiri Talk!
C# Code help..
Get the App
JavaScript is disabled. For a better experience, please enable JavaScript in your browser before proceeding.
You are using an out of date browser. It may not display this or other websites correctly.
You should upgrade or use an
alternative browser
.
Message
<blockquote data-quote="maleesha udan" data-source="post: 28493234" data-attributes="member: 570077"><p><strong>There is a syntax error on this line:</strong></p><p></p><p></p><p>private void Form1_Load(object sender, EventArgs e)</p><p></p><p>It should be inside the Form1_Load class, like this:</p><p></p><p></p><p></p><p>public partial class Form1_Load : Form</p><p>{</p><p> //other code here</p><p></p><p> private void Form1_Load(object sender, EventArgs e)</p><p> {</p><p> try</p><p> {</p><p> TreeView myTreeView = new TreeView();</p><p> treeView2.Nodes.Clear();</p><p> foreach (var parentText in Languageslists)</p><p> {</p><p> TreeNode parent = new TreeNode();</p><p> parent.Text = parentText.Name;</p><p> treeView2.Nodes.Add(parent);</p><p></p><p> foreach (string childText in parentText.List)</p><p> {</p><p> TreeNode child = new TreeNode();</p><p> child.Text = childText;</p><p> parent.Nodes.Add(child);</p><p></p><p> }</p><p></p><p> }</p><p> }</p><p> catch (Exception ex)</p><p> {</p><p> MessageBox.Show(ex.Message);</p><p> }</p><p> }</p><p>}</p><p></p><p></p><p></p><p><strong>There is another error in this line:</strong></p><p><strong></strong></p><p><strong>Languageslists.Add(new Languages {Name = "Open Source", List = windowsProgramminglanguages });</strong></p><p><strong></strong></p><p><strong>You are adding the windowsProgramminglanguages array to the List property, but it should be the OSProgramminglanguages array.</strong></p><p><strong></strong></p><p><strong>The same issue occurs in these lines:</strong></p><p></p><p></p><p></p><p>Languageslists.Add(new Languages {Name = "DataBase" , List = windowsProgramminglanguages });</p><p>Languageslists.Add(new Languages {Name = "CMS Software", List = windowsProgramminglanguages });</p><p></p><p></p><p><strong>It should be:</strong></p><p></p><p>Languageslists.Add(new Languages {Name = "Open Source", List = OSProgramminglanguages });</p><p>Languageslists.Add(new Languages {Name = "DataBase" , List = DataBase });</p><p>Languageslists.Add(new Languages {Name = "CMS Software", List = CMS });</p><p></p><p></p><p></p><p></p><p>here is no syntax error in the rest of the code.</p><p></p><p>However, there are a few suggestions I can make to improve the code:</p><p></p><ol> <li data-xf-list-type="ol">It is generally a good practice to follow a naming convention for variables and classes. In this case, the class Form1_Load should be named in PascalCase, like Form1Load.</li> <li data-xf-list-type="ol">You can simplify the creation of the Languages objects in the Languageslists list by using an array of Languages objects and the AddRange method of the List class.</li> </ol><p></p><p><span style="font-size: 26px"><strong>Chat GPT eken Dunna Answer eka</strong></span></p></blockquote><p></p>
[QUOTE="maleesha udan, post: 28493234, member: 570077"] [B]There is a syntax error on this line:[/B] private void Form1_Load(object sender, EventArgs e) It should be inside the Form1_Load class, like this: public partial class Form1_Load : Form { //other code here private void Form1_Load(object sender, EventArgs e) { try { TreeView myTreeView = new TreeView(); treeView2.Nodes.Clear(); foreach (var parentText in Languageslists) { TreeNode parent = new TreeNode(); parent.Text = parentText.Name; treeView2.Nodes.Add(parent); foreach (string childText in parentText.List) { TreeNode child = new TreeNode(); child.Text = childText; parent.Nodes.Add(child); } } } catch (Exception ex) { MessageBox.Show(ex.Message); } } } [B]There is another error in this line: Languageslists.Add(new Languages {Name = "Open Source", List = windowsProgramminglanguages }); You are adding the windowsProgramminglanguages array to the List property, but it should be the OSProgramminglanguages array. The same issue occurs in these lines:[/B] Languageslists.Add(new Languages {Name = "DataBase" , List = windowsProgramminglanguages }); Languageslists.Add(new Languages {Name = "CMS Software", List = windowsProgramminglanguages }); [B]It should be:[/B] Languageslists.Add(new Languages {Name = "Open Source", List = OSProgramminglanguages }); Languageslists.Add(new Languages {Name = "DataBase" , List = DataBase }); Languageslists.Add(new Languages {Name = "CMS Software", List = CMS }); here is no syntax error in the rest of the code. However, there are a few suggestions I can make to improve the code: [LIST=1] [*]It is generally a good practice to follow a naming convention for variables and classes. In this case, the class Form1_Load should be named in PascalCase, like Form1Load. [*]You can simplify the creation of the Languages objects in the Languageslists list by using an array of Languages objects and the AddRange method of the List class. [/LIST] [SIZE=7][B]Chat GPT eken Dunna Answer eka[/B][/SIZE] [/QUOTE]
Insert quotes…
Verification
Hata thunen beduwama keeyada? (60 bedeema thuna)
Post reply
Top
Bottom