I can't for the life of me figure out how to get my sql query results to display on separate lines in the listbox on mainform. Without using the INAudioPlugin I can do this no problem but using this I can't seem to accomplish what I want. I can get my results to the listbox but all are on a single line. How can I accomplish this using the plugin?
In my mainform.cs I have the following:
In my mainform.cs I have the following:
[ImportingConstructor]
public MainForm([ImportMany] IEnumerable<AudioPlugin> content)
{
InitializeComponent();
listBox.DisplayMember = "Name";
foreach (var listing in content)
{
listBox.Items.Add(listing);
}
}
In my recordingpanel.cs I have the following: [Export(typeof(INAudioPlugin))]
public class RecordingPanelPlugin : AudioPlugin
{
private string _customer { get; set; }
public void ConnectionString()
{
using (var conn = new SqlCeConnection("Data Source=MyDatabase.sdf;Password=pass;Persist Security Info=True"))
{
conn.Open();
var comm = new SqlCeCommand("SELECT * FROM main", conn);
SqlCeDataReader reader = comm.ExecuteReader();
while (reader.Read())
{
_customer += (string)(reader["CustomerName"]);
}
}
}
public string Name
{
get
{
ConnectionString();
return _customer;
}
}
public Control CreatePanel()
{
return new RecordingPanel();
}
}
Please help. I have spent literally hours trying to figure this out. I have output the results to a listbox as well but when I try to use the plugin they still input in a single string. If I do a Console.WriteLine I see each result on a separate line as I expect.