hello freinds
i am writting a program include below forms.
every photo is for one of forms.
i am using 3 layer architecture on entity framework.it's photo is in below link:
http://www.8pic.ir/viewer.php?file=17540479024128000147.jpg[
^]
i have a main form :
http://www.8pic.ir/viewer.php?file=74547582891822146724.jpg[
^]
there is some button on top of that.i click add button.
next form appears on the screen.
http://www.8pic.ir/viewer.php?file=66707912746213610128.jpg[
^]
there are textbox and combobox and a UserControl under the form in to a panel.
i select a item in the listbox.
a user control add to my panel.
//-----------------------------------------------------------------------------
i made my question shorter.i need a guidline.
<pre lang="sql">in my code i am using a string array to save contents of listbox.i want to modify it to save contents of listbox in a datasource that it's contents be from type of a
entity.
i need to know that how i use a datasource to save temporarily a list of data in a user control which are not type of string. they should be type of a Entity.</pre></pre>
i need a thing like this picture.
<a href="http://www.8pic.ir/images/78697864078681572287.png">http://www.8pic.ir/images/78697864078681572287.png</a>[<a href="http://www.8pic.ir/images/78697864078681572287.png" target="_blank" title="New Window">^</a>]
next
<a href="http://www.8pic.ir/images/51362496456109944330.png">http://www.8pic.ir/images/51362496456109944330.png</a>[<a href="http://www.8pic.ir/images/51362496456109944330.png" target="_blank" title="New Window">^</a>]
next
<a href="http://www.8pic.ir/images/63598240075710477715.png">http://www.8pic.ir/images/63598240075710477715.png</a>[<a href="http://www.8pic.ir/images/63598240075710477715.png" target="_blank" title="New Window">^</a>]
thanks to help me.
//--------------------------------------------------------------------------------------
this was my wrong code:
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Drawing;
using System.Data;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using InspectorSys.Model;
using InspectorSys.BLL;
namespace InspectorSys.UI
{
public partial class UcMultiChoiceResponse : UserControl
{
int counter = -1;
string[] array1 = new string[500];
multichoiceresponsetype>
MultiChoiceResponseTypeBusiness biz = new MultiChoiceResponseTypeBusiness();
List<responsechoice> ResponseChoice = new List<responsechoice>();
List<multichoiceresponsetype>
ResponseChoice selectedResponseChoice;
List<responsechoice> responceChoiceList;
ResponseChoiceBusiness responceChoiceBiz;
AddEditState addEditState;
public ResponseChoice SelectedResponseChoice
{
get { return selectedResponseChoice; }
}
public UcMultiChoiceResponse(ResponseChoiceBusiness responceChoiceBiz, List<responsechoice> responceChoiceList, ResponseChoice selectedResponseChoice = null)
{
InitializeComponent();
}
private void btnResponseChoice_Click(object sender, EventArgs e)
{
bdsResponseChoice.EndEdit();
txtMultiChoice.Enabled = true;
try
{
if (txtMultiChoice.Text != "")
{
counter++;
lbUcMultiChoice.Items.Add(txtMultiChoice.Text);
multiChoiceResponseType.AddRange((MultiChoiceResponseType)txtMultiChoice.Text.ToList());
lbUcMultiChoice.SelectedIndex = lbUcMultiChoice.Items.Count - 1;
array1[counter] = txtMultiChoice.Text;
txtMultiChoice.Text = null;
txtMultiChoice.Focus();
lbUcMultiChoice.ClearSelected();
this.lbUcMultiChoice.SelectedIndex = this.lbUcMultiChoice.Items.Count - 1;
}
if (counter >= 0)
{
delbtnMultiChoice.Enabled = true;
}
}
catch { };
lbUcMultiChoice.Focus();
}
private void button2_Click(object sender, EventArgs e)
{
counter--;
for (int i = 0; i < lbUcMultiChoice.SelectedItems.Count; i++)
lbUcMultiChoice.Items.Remove(lbUcMultiChoice.SelectedItems[i]);
this.lbUcMultiChoice.SelectedIndex = this.lbUcMultiChoice.Items.Count - 1;
delbtnMultiChoice.Enabled = true;
if (counter < 1)
{
delbtnMultiChoice.Enabled = false;
}
}
}
}