Hi I am trying to learn/understand classes, so I built a small app with just a button and a text field to test.
Here is my main code file
Here is my simple class fileCode:using System; using System.Collections.Generic; using System.Drawing; using System.Windows.Forms; namespace Class_Test { public partial class MainForm : Form { public MainForm() { InitializeComponent(); } void MainFormLoad(object sender, EventArgs e) { } void Button1Click(object sender, EventArgs e) { Connection test = new Connection(); label1.Text = test.dbPath; } } }
I am having issues just trying to pass a simple string to a text label.Code:using System; using System.Text; namespace Class_Test { class Connection { public string dbPath() { string Path = "DATASOURCE"; return Path; } } }
getting an error stating
"can not convert method group (dbPath) to non-delegate type string.
Thanks for the help




Reply With Quote