本文整理汇总了C#中System.Windows.Forms.BindingSource类的典型用法代码示例。如果您正苦于以下问题:C# BindingSource类的具体用法?C# BindingSource怎么用?C# BindingSource使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
BindingSource类属于System.Windows.Forms命名空间,在下文中一共展示了BindingSource类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。
示例1: button1_Click
private void button1_Click(object sender, EventArgs e)
{
try
{
MySqlConnection myConn = new MySqlConnection();
myConn.Host = "192.168.69.8";
myConn.Port = 3306;
myConn.UserId = "cody";
myConn.Password = "greenstreetelite";
myConn.Open();
MySqlCommand myCommand = new MySqlCommand(" SELECT * FROM registration.regUser ;", myConn);
MySqlDataAdapter myDataAdapter = new MySqlDataAdapter();
myDataAdapter.SelectCommand = myCommand;
DataTable dbDataSet = new DataTable();
myDataAdapter.Fill(dbDataSet);
BindingSource bSource = new BindingSource();
bSource.DataSource = dbDataSet;
dataGridView1.DataSource = bSource;
myDataAdapter.Update(dbDataSet);
}
catch (Exception ex)
{
MessageBox.Show(ex.Message);
}
}
开发者ID:heidar-ali,项目名称:mysql-connector,代码行数:28,代码来源:Form1.cs
示例2: ArticleModifierPresenter
public ArticleModifierPresenter(IArticleModifierView view)
{
_view = view;
listeArticlesToDisplay.AddRange(listeArticles);
source = new BindingSource(listeArticlesToDisplay, null);
}
开发者ID:shambarick,项目名称:Carbouffe,代码行数:7,代码来源:ArticleModifierPresenter.cs
示例3: frmSales
public frmSales()
{
InitializeComponent();
bsSales = new BindingSource();
dgvSales.AutoGenerateColumns = false;
BindSalesData();
}
开发者ID:iprodanov,项目名称:IPStoreManager,代码行数:7,代码来源:frmSales.cs
示例4: fillgridDef
private void fillgridDef()
{
id = -1;
buttonDel.Visible = false;
buttonEdit.Visible = false;
buttonIns.Visible = false;
buttonCancel.Visible = false;
DBConnect NewcConnection = new DBConnect();
NewcConnection.dbConnection();
MySqlCommand querysql = new MySqlCommand("Select * From deficiencias", DBConnect.db);
try
{
MySqlDataAdapter dados = new MySqlDataAdapter();
dados.SelectCommand = querysql;
DataTable tabela = new DataTable();
dados.Fill(tabela);
BindingSource fonte = new BindingSource();
fonte.DataSource = tabela;
dataGridView1.DataSource = fonte;
this.dataGridView1.Columns[0].Visible = false;
dataGridView1.Columns[1].HeaderText = "Deficiencia";
dados.Update(tabela);
dataGridView1.AutoResizeColumns();
dataGridView1.AutoSizeColumnsMode = DataGridViewAutoSizeColumnsMode.AllCells;
}
catch (Exception ex)
{
MessageBox.Show(ex.Message);
}
DBConnect.db.Close();
textBoxDef.Clear();
}
开发者ID:hortopericial,项目名称:horto-c-sharp,代码行数:34,代码来源:Deficiencia.cs
示例5: Cliente_Load
private void Cliente_Load(object sender, EventArgs e)
{
cmbTipo.DataSource = _billData.GetIdentificationType();
cmbTipo.ValueMember = "Id";
cmbTipo.DisplayMember = "Description";
if (cmbTipo.Items.Count > 0)
{
cmbTipo.SelectedIndex = 0;
}
else
{
MessageBox.Show("Error - revise la configuración del sistema");
}
BindingSource clientSource = new BindingSource();
clientSource.DataSource = new List<ClientModel>();
dtgCliente.DataSource = clientSource;
((DataGridViewComboBoxColumn)dtgCliente.Columns["TypeList"])
.DataSource = _billData.GetIdentificationType();
((DataGridViewComboBoxColumn)dtgCliente.Columns["TypeList"])
.DisplayMember = "Description";
((DataGridViewComboBoxColumn)dtgCliente.Columns["TypeList"])
.ValueMember = "Id";
((DataGridViewComboBoxColumn)dtgCliente.Columns["TypeList"])
.DataPropertyName = "IdIdentificationType";
}
开发者ID:ARESFAAS,项目名称:SolucionFacturando,代码行数:26,代码来源:Cliente.cs
示例6: BindModel
private void BindModel()
{
var mod = this.Manager.ActiveModel;
BindingSource bsMod = new BindingSource();
bsMod.DataSource = mod;
BindingSource bsPermits = new BindingSource();
bsPermits.DataSource = this.Manager.Permits;
Permits.DataSource = bsPermits;
BindingSource bsReminders = new BindingSource();
bsReminders.DataSource = mod.Reminders;
gridControlReminders.DataSource = bsReminders;
DriverID.DataBindings.Clear();
DriverID.DataBindings.Add("DriverID", bsMod, mod.GetName(p => p.DriverID), true, DataSourceUpdateMode.OnPropertyChanged);
LicenseID.DataBindings.Clear();
LicenseID.DataBindings.Add("EditValue", bsMod, mod.GetName(p => p.LicenseID), true, DataSourceUpdateMode.OnPropertyChanged);
IssueDate.DataBindings.Clear();
IssueDate.DataBindings.Add("EditValue", bsMod, mod.GetName(p => p.IssueDate), true, DataSourceUpdateMode.OnPropertyChanged);
ExpirationDate.DataBindings.Clear();
ExpirationDate.DataBindings.Add("EditValue", bsMod, mod.GetName(p => p.ExpirationDate), true, DataSourceUpdateMode.OnPropertyChanged);
MVRReviewDate.DataBindings.Clear();
MVRReviewDate.DataBindings.Add("EditValue", bsMod, mod.GetName(p => p.MVRReviewDate), true, DataSourceUpdateMode.OnPropertyChanged);
for (int i = 0; i < this.Manager.Permits.Count; i++)
{
var per = this.Manager.Permits[i];
Permits.SetItemChecked(i, per.IsCheck);
}
}
开发者ID:Ravenheart,项目名称:driversolutions,代码行数:35,代码来源:XF_DriverLicenseNewEdit.cs
示例7: button3_Click
private void button3_Click(object sender, EventArgs e)
{
this.webBrowser1.ScriptErrorsSuppressed = true;
this.webBrowser2.ScriptErrorsSuppressed = true;
XDocument docRss = XDocument.Load("http://tw.news.yahoo.com/rss/weather");
this.webBrowser1.DocumentText = docRss.ToString();
var query = from item in docRss.Descendants("item")
select new
{
標題 = item.Element("title").Value,
說明 = item.Element("description").Value,
發佈日期 = item.Element("pubDate").Value
};
dataGridView1.DataSource = query.ToList();
//for BindingSource====================
BindingSource bs = new BindingSource();
dataGridView4.DataSource = bs;
bs.DataSource = query.ToList();
this.webBrowser2.DataBindings.Add("DocumentText", bs, "說明");
//this.dataRepeater2.DataSource = query.ToList();
}
开发者ID:YiYingChuang,项目名称:LinQ,代码行数:29,代码来源:7.+FrmLinqToXML_JSON.cs
示例8: loadHeroDiary
private void loadHeroDiary()
{
// Load the latest Hero Diary entries
using (SQLiteConnection conn = new SQLiteConnection(@"Data Source=" + dbPath + @"\gv.db;Version=3;New=False;Compress=True;"))
{
conn.Open();
using (SQLiteCommand cmd = conn.CreateCommand())
{
string commandText = "select Diary_ID as ID, Updated, EntryTime, Entry from Diary where [email protected] order by Diary_ID desc limit 1000";
cmd.CommandText = commandText;
cmd.Parameters.AddWithValue("@HeroName", this.HeroName);
SQLiteDataAdapter da = new SQLiteDataAdapter(cmd);
DataSet ds = new DataSet();
da = new SQLiteDataAdapter(cmd);
ds = new DataSet();
da.Fill(ds);
BindingSource bindingSource = new BindingSource();
bindingSource.DataSource = ds.Tables[0];
grdDiary.DataSource = bindingSource;
grdDiary.AutoGenerateColumns = true;
grdDiary.AutoSizeRowsMode = DataGridViewAutoSizeRowsMode.DisplayedCellsExceptHeaders;
grdDiary.AutoSizeColumnsMode = DataGridViewAutoSizeColumnsMode.AllCells;
}
}
}
开发者ID:DougThompson,项目名称:GodvilleAutoPlayer,代码行数:27,代码来源:frmDiary.cs
示例9: LoadAllBook
public void LoadAllBook()
{
try
{
DBManager manager = new DBManager();
SqlConnection connection = manager.Connection();
string selectQuery = "SELECT * From Books";
SqlCommand cmd = new SqlCommand(selectQuery, connection);
//connection.Open();
SqlDataAdapter adapter = new SqlDataAdapter();
adapter.SelectCommand = cmd;
dataTable = new DataTable();
adapter.Fill(dataTable);
BindingSource binding = new BindingSource();
binding.DataSource = dataTable;
dataGridView1.DataSource = dataTable;
adapter.Update(dataTable);
}
catch ( SqlException exception)
{
MessageBox.Show(exception.Message);
}
}
开发者ID:salamcseiu21,项目名称:Library-Management-With-CSharp-Desktop-,代码行数:27,代码来源:OrderUI.cs
示例10: FatuSemana_Load
private void FatuSemana_Load(object sender, EventArgs e)
{
this.label4.DataBindings.Clear();
dataSistema = DateTime.Now.ToShortDateString();
string data="",sDataF="";
data = dataSistema;
DateTime d = Convert.ToDateTime(data);
sDataF = d.ToString("yyyyMMdd");
try
{
MySqlConnection con = new MySqlConnection("SERVER=localhost;" + " DATABASE=banco_rr_sacoles;" + " UID=root;" + "PASSWORD=12345;");
MySqlDataAdapter sql = new MySqlDataAdapter("SELECT SUM( total ) AS total FROM faturamento WHERE data BETWEEN DATE_SUB(CURDATE(), INTERVAL 7 DAY) and '" + sDataF + "'", con);
//SELECT DATE_SUB(CURDATE(), INTERVAL 7 DAY);
DataTable dt = new DataTable();
sql.Fill(dt);
BindingSource source = new BindingSource();
source.DataSource = dt;
this.label4.DataBindings.Add("Text", source, "total", true);
string total = label4.Text;
Decimal tt = Convert.ToDecimal(total);
String tot = tt.ToString("N", new CultureInfo("pt-BR"));
tbxFaturamento.Text = ("R$ " + (String.Format("{0:0.00}",tt))).ToString();
con.Close();
}
catch (Exception ex)
{
ex.Message.ToString();
//throw new Exception("Erro de comandos: " + ex.Message);
}
}
开发者ID:nbleonardo,项目名称:scvs,代码行数:30,代码来源:FatuSemana.cs
示例11: OknoGlowne
public OknoGlowne()
{
InitializeComponent();
Dane = new DataTable();
for (int i = 0; i < 80; i++) Dane.Columns.Add();
//Dane.Columns.
for (int i = 0; i < 79; i++) Dane.Rows.Add();
Mapa.RowTemplate.Height = 5;
BindingSource bindingSource = new BindingSource();
bindingSource.DataSource = Dane;
Mapa.DataSource = bindingSource;
for (int i = 0; i < 80; i++) Mapa.Columns[i].Width = 5;
BaudRateBox.Items.Add("250000");
BaudRateBox.Items.Add("9600");
BaudRateBox.SelectedIndex = 0;
COMPortBox.Items.Add("COM7");
COMPortBox.SelectedIndex = 0;
USART.BaudRate = 250000;
USART.PortName = "COM7";
}
开发者ID:MichalNowicki,项目名称:LeapMotion,代码行数:27,代码来源:OknoGlowne.cs
示例12: SetCmbBoxBindingSrc
//void bs_AddingNew(object sender, AddingNewEventArgs e)
//{
// // check if client full name already exists
// if (((List<Client>)(bs.DataSource)).
// Any(x => x.FullName == ((Client)(e.NewObject)).FullName))
// {
// }
//}
public void SetCmbBoxBindingSrc(List<Client> clients)
{
bs = new BindingSource(clients, null);
// bs.AddingNew += new AddingNewEventHandler(bs_AddingNew);
//bs.
cmbBox_existingClients.DisplayMember = "FullName";
}
开发者ID:fiveohhh,项目名称:Client-Tracker,代码行数:15,代码来源:GetClient.cs
示例13: HistoryPresenterModel
public HistoryPresenterModel(IUnitInfoDatabase database)
{
if (database == null) throw new ArgumentNullException("database");
_database = database;
Debug.Assert(_database.Connected);
_queryList = new List<QueryParameters>();
_queryList.Add(new QueryParameters());
_queryList.Sort();
_queryBindingSource = new BindingSource();
_queryBindingSource.DataSource = _queryList;
_queryBindingSource.CurrentItemChanged += (s, e) =>
{
OnPropertyChanged("EditAndDeleteButtonsEnabled");
_currentPage = 1;
ResetBindings(true);
};
_historyList = new HistoryEntrySortableBindingList();
_historyList.Sorted += (s, e) =>
{
SortColumnName = e.Name;
SortOrder = e.Direction;
};
_historyBindingSource = new BindingSource();
_historyBindingSource.DataSource = _historyList;
_page = new PetaPoco.Page<HistoryEntry> { Items = new List<HistoryEntry>() };
}
开发者ID:harlam357,项目名称:hfm-net,代码行数:30,代码来源:HistoryPresenterModel.cs
示例14: Form1_Load
private void Form1_Load(object sender, EventArgs e)
{
viewPorts = new BindingSource();
windows = new BindingSource();
viewPorts.DataSource = typeof(ViewPort);
windows.DataSource = typeof(ViewPortForm);
if (File.Exists(configFile))
{
loadedCfg = Helpers.LoadConfig(configFile);
viewPorts.DataSource = (BindingList<ViewPort>)loadedCfg.ViewPorts;
}
else
{// should move this to helper
MessageBox.Show(configFile + " not found! Please create a config File", "ERROR", MessageBoxButtons.OK, MessageBoxIcon.Stop, MessageBoxDefaultButton.Button1
, MessageBoxOptions.ServiceNotification);
this.Close();
}
foreach (ViewPort vp in viewPorts)
{
ViewPortForm vpWindow = new ViewPortForm(vp);
vpWindow.Size = new Size(vp.SizeX, vp.SizeY);
vpWindow.FormBorderStyle = System.Windows.Forms.FormBorderStyle.None;
vpWindow.Text = vp.Name;
vpWindow.Show();
vpWindow.DesktopLocation = new Point(vp.ScreenPositionX, vp.ScreenPositionY);
windows.Add(vpWindow);
}
}
开发者ID:danvac,项目名称:hogkeys.iris,代码行数:32,代码来源:IrisClient.cs
示例15: AddData
private void AddData(string sPathEn, string sPathVi)
{
try
{
string[] filePathEn = Directory.GetFiles(sPathEn, "*.ini");
string[] filePathVi = Directory.GetFiles(sPathVi, "*.ini");
var bindingSource = new BindingSource();
data = new List<SimpleDataFile>();
for (int i = 0; i < filePathEn.Length; i++)
{
string[] aPathVi = filePathVi.Where(w => (Path.GetFileName(w).Remove(0, 6) == Path.GetFileName(filePathEn[i]).Remove(0, 6))).ToArray();
string pathvi = "";
string Tenfilevi = "";
if (aPathVi.Length > 0)
{
pathvi = aPathVi[0];
Tenfilevi = Path.GetFileName(aPathVi[0]);
keyLang = Tenfilevi.Split('.')[0];
}
bindingSource.Add(new SimpleDataFile { Chon = false, TenFileEn = Path.GetFileName(filePathEn[i]), TenFileVi = Tenfilevi, PathEn = filePathEn[i], PathVi = pathvi });
data.Add(new SimpleDataFile { Chon = false, TenFileEn = Path.GetFileName(filePathEn[i]), TenFileVi = Tenfilevi, PathEn = filePathEn[i], PathVi = pathvi });
}
gvEn.DataSource = bindingSource;
}
catch (Exception ex)
{
MessageBox.Show("Có lỗi xảy ra khi load dữ liệu");
}
}
开发者ID:huynhduy1985,项目名称:Joomla-translator,代码行数:29,代码来源:TranslatorJoomla.cs
示例16: DisplaySetCreationConfigurationComponentControl
/// <summary>
/// Constructor.
/// </summary>
public DisplaySetCreationConfigurationComponentControl(DisplaySetCreationConfigurationComponent component)
:base(component)
{
_component = component;
InitializeComponent();
_bindingSource = new BindingSource {DataSource = _component.Options};
_modality.DataSource = _bindingSource;
_modality.DisplayMember = "Modality";
_createSingleImageDisplaySets.DataBindings.Add("Checked", _bindingSource, "CreateSingleImageDisplaySets", false, DataSourceUpdateMode.OnPropertyChanged);
_createSingleImageDisplaySets.DataBindings.Add("Enabled", _bindingSource, "CreateSingleImageDisplaySetsEnabled", false, DataSourceUpdateMode.OnPropertyChanged);
_createAllImagesDisplaySet.DataBindings.Add("Checked", _bindingSource, "CreateAllImagesDisplaySet", false, DataSourceUpdateMode.OnPropertyChanged);
_createAllImagesDisplaySet.DataBindings.Add("Enabled", _bindingSource, "CreateAllImagesDisplaySetEnabled", false, DataSourceUpdateMode.OnPropertyChanged);
_showOriginalSeries.DataBindings.Add("Checked", _bindingSource, "ShowOriginalSeries", false, DataSourceUpdateMode.OnPropertyChanged);
_showOriginalSeries.DataBindings.Add("Enabled", _bindingSource, "ShowOriginalSeriesEnabled", false, DataSourceUpdateMode.OnPropertyChanged);
_splitEchos.DataBindings.Add("Checked", _bindingSource, "SplitMultiEchoSeries", false, DataSourceUpdateMode.OnPropertyChanged);
_splitEchos.DataBindings.Add("Enabled", _bindingSource, "SplitMultiEchoSeriesEnabled", false, DataSourceUpdateMode.OnPropertyChanged);
_showOriginalMultiEchoSeries.DataBindings.Add("Checked", _bindingSource, "ShowOriginalMultiEchoSeries", false, DataSourceUpdateMode.OnPropertyChanged);
_showOriginalMultiEchoSeries.DataBindings.Add("Enabled", _bindingSource, "ShowOriginalMultiEchoSeriesEnabled", false, DataSourceUpdateMode.OnPropertyChanged);
_splitMixedMultiframeSeries.DataBindings.Add("Checked", _bindingSource, "SplitMixedMultiframes", false, DataSourceUpdateMode.OnPropertyChanged);
_splitMixedMultiframeSeries.DataBindings.Add("Enabled", _bindingSource, "SplitMixedMultiframesEnabled", false, DataSourceUpdateMode.OnPropertyChanged);
_showOriginalMixedMultiframeSeries.DataBindings.Add("Checked", _bindingSource, "ShowOriginalMixedMultiframeSeries", false, DataSourceUpdateMode.OnPropertyChanged);
_showOriginalMixedMultiframeSeries.DataBindings.Add("Enabled", _bindingSource, "ShowOriginalMixedMultiframeSeriesEnabled", false, DataSourceUpdateMode.OnPropertyChanged);
_invertImages.DataBindings.Add("Checked", _bindingSource, "ShowGrayscaleInverted", false, DataSourceUpdateMode.OnPropertyChanged);
_invertImages.DataBindings.Add("Enabled", _bindingSource, "ShowGrayscaleInvertedEnabled", false, DataSourceUpdateMode.OnPropertyChanged);
}
开发者ID:emmandeb,项目名称:ClearCanvas-1,代码行数:38,代码来源:DisplaySetCreationConfigurationComponentControl.cs
示例17: GetData
private void GetData()
{
//Set command
SqlCommand cmd = new SqlCommand();
cmd.Connection = conn;
cmd.CommandText = "ReportOnClients";
cmd.CommandType = CommandType.StoredProcedure;
//Set adapter
SqlDataAdapter daClients = new SqlDataAdapter();
DataSet dsClients = new DataSet();
BindingSource bsClients = new BindingSource();
try
{
conn.Open();
daClients.SelectCommand = cmd;
daClients.Fill(dsClients);
bsClients.DataSource = dsClients.Tables[0];
//Bind to dgv
dgvClientsLookingToRent.DataSource = bsClients;
}
catch(Exception exc)
{
MessageBox.Show(exc.ToString());
}
finally
{
conn.Close();
}
}
开发者ID:rowyhoffy,项目名称:MyFirstRepo,代码行数:29,代码来源:frmReportOnClients.cs
示例18: AutoSave
private void AutoSave()
{
if (lastSavedFile != "") {
dataGridView1.EndEdit();
BindingSource bs = new BindingSource();
//dat = (DataTable) (dataGridView1.DataSource);
//dat.AcceptChanges();
//dat.TableName = "saveData";
//dat.WriteXml("data.xsd", XmlWriteMode.WriteSchema);
//BindingSource bs = (BindingSource)dataGridView1.DataSource;
DataTable dt = dataGridView1.DataSource as DataTable;
//dataGridView1.Update();
if (dt != null){
dt.TableName = "AutoDataSave";
//SaveFileDialog fileDialog = new SaveFileDialog();
dt.WriteXml(lastSavedFile, XmlWriteMode.WriteSchema);
System.Windows.Forms.MessageBox.Show("Data Saved");
}
}
else {
lastSavedFile = "temp";
}
}
开发者ID:Hol1x,项目名称:Inventory,代码行数:28,代码来源:excelImportForm.cs
示例19: TestBook
public void TestBook()
{
try
{
DBManager manager1 = new DBManager();
SqlConnection connection = manager1.Connection();
string seletQuery = "select * from Books Order by Name";
SqlCommand selectCmd = new SqlCommand(seletQuery, connection);
connection.Open();
SqlDataAdapter myAdapter = new SqlDataAdapter();
myAdapter.SelectCommand = selectCmd;
dt = new DataTable();
myAdapter.Fill(dt);
BindingSource bSource = new BindingSource();
bSource.DataSource = dt;
dataGridView1.DataSource = dt;
myAdapter.Update(dt);
//return null;
}
catch (Exception obj)
{
throw new Exception("Error", obj);
}
}
开发者ID:salamcseiu21,项目名称:Library-Management-With-CSharp-Desktop-,代码行数:30,代码来源:UpdateUI.cs
示例20: afiseazaStudentiCazati
private void afiseazaStudentiCazati(object sender, EventArgs e)
{
int nr = Convert.ToInt32(textBox3.Text);
double min = Convert.ToDouble(textBox4.Text);
double max = Convert.ToDouble(textBox5.Text);
List<FisaCazare> fise = new List<FisaCazare>();
foreach (DataRowView drv in studentiBindingSource.List)
{
int suma = 0;
int n = 0;
foreach (DataRow dr in databaseDataSet.Tables[1].Rows)
if (drv["Nr_matricol"].ToString().Equals(dr["Nr_matricol"].ToString()))
{
suma += Convert.ToInt32(dr["Nota"].ToString());
n++;
}
FisaCazare fisa = new FisaCazare(drv["Nume"].ToString(), drv["Prenume"].ToString(), drv["Facultate"].ToString(), Convert.ToInt32(drv["An"].ToString()), Math.Round((double)suma / n,2));
fise.Add(fisa);
}
List<FisaCazare> SortedList = fise.OrderByDescending(o => o.Medie).ToList().FindAll(c => (c.Medie<=max) && (c.Medie>=min));
while (SortedList.Count > nr)
SortedList.RemoveAt(SortedList.Count - 1);
var bindingList = new BindingList<FisaCazare>(SortedList);
var source = new BindingSource(bindingList, null);
dataGridView1.DataSource = source;
}
开发者ID:am1guma,项目名称:PSSC,代码行数:26,代码来源:UPT.cs
注:本文中的System.Windows.Forms.BindingSource类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论