TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Forums
Monthly Leaders
Forum guidelines
sameer pankaj
NA
1
1.2k
how to display data from database in combobox in c#
Jul 29 2014 2:50 AM
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
namespace Dynamic.Account.Report.Transaction
{
public partial class FrmRptTrialBalanceMonthly : Form//FrmReportBaseForm<Dynamic.ReportEntity.Account.TrialBalance>
{
Dynamic.Reporting.Account.TrialBalanceSheetMonthly TrialBalanceMonthly = new Dynamic.Reporting.Account.TrialBalanceSheetMonthly();
public FrmRptTrialBalanceMonthly()
{
InitializeComponent();
System.Windows.Forms.Control.CheckForIllegalCrossThreadCalls = false;
this.TabText = "List of Ledger";
this.Load += new EventHandler(FrmRptTrialBalanceMonthly_Load);
this.FormClosing += new FormClosingEventHandler(FrmRptTrialBalanceMonthly_FormClosing);
this.btnPrint.Click += new EventHandler(btnPrint_Click);
}
public System.Collections.IEnumerable DataColl
{
get
{
return fastObjectListView1.FilteredObjects;
}
}
public void GetDataOfCurrentRow(object obj, Dynamic.ReportEngine.RDL.Row row)
{
Dynamic.ReportEntity.Account.TrialBalance tbl = (Dynamic.ReportEntity.Account.TrialBalance)obj;
row.Data[0] = tbl.Month;
row.Data[1] = tbl.OpeningDr;
row.Data[2] = tbl.OpeningCr;
row.Data[3] = tbl.TransactionDr;
row.Data[4] = tbl.TransactionCr;
}
void btnPrint_Click(object sender, EventArgs e)
{
ShowReportForm(@"D:\DynamicAccounting\Accounting\New Account\Ledger.rdl", "TestObjectData");
}
private void ShowReportForm(string path, string title)
{
Dynamic.ReportEngine.FrmRptCustomizeReportView frm = new ReportEngine.FrmRptCustomizeReportView();
//frm.iReportData = this;
frm.SourceFile = path;
frm.TabText = title;
frm.Show();
}
void FrmRptTrialBalanceMonthly_FormClosing(object sender, FormClosingEventArgs e)
{
}
public void LoadDataFromDB()
{
fastObjectListView1.SetObjects(TrialBalanceMonthly.getTrailBalance(DateTime.Today, DateTime.Today,2,6));
}
void FrmRptTrialBalanceMonthly_Load(object sender, EventArgs e)
{
getterAndSetter();
LoadDataFromDB();
}
private void getterAndSetter()
{
olvMonth.AspectGetter = delegate(object x)
{
if (x is Dynamic.ReportEntity.Account.TrialBalance)
{
return ((Dynamic.ReportEntity.Account.TrialBalance)x).Month;
}
return "";
};
olvOpeningDr.AspectGetter = delegate(object x)
{
if (x is Dynamic.ReportEntity.Account.TrialBalance)
{
return ((Dynamic.ReportEntity.Account.TrialBalance)x).OpeningDr;
}
return "";
};
olvOpeningCr.AspectGetter = delegate(object x)
{
if (x is Dynamic.ReportEntity.Account.TrialBalance)
{
return ((Dynamic.ReportEntity.Account.TrialBalance)x).OpeningCr;
}
return "";
};
olvTransactionDr.AspectGetter = delegate(object x)
{
if (x is Dynamic.ReportEntity.Account.TrialBalance)
{
return ((Dynamic.ReportEntity.Account.TrialBalance)x).TransactionDr;
}
return "";
};
olvTransactionCr.AspectGetter = delegate(object x)
{
if (x is Dynamic.ReportEntity.Account.TrialBalance)
{
return ((Dynamic.ReportEntity.Account.TrialBalance)x).TransactionCr;
}
return "";
};
}
private void FrmRptTrialBalanceMonthly_Load_1(object sender, EventArgs e)
{
}
}
}
i want coding for dispalyin data from database in combobox in c#
Reply
Answers (
0
)
Searching Record From a DataBase and Displaying In a Gridviw
Button Event