Click here to Skip to main content
15,887,371 members
Home / Discussions / C#
   

C#

 
AnswerRe: Design question - asynchronous(?) processing Pin
Russell Jones7-Nov-06 21:24
Russell Jones7-Nov-06 21:24 
Questionhow to retieve text from image from file Pin
suma123827-Nov-06 14:14
suma123827-Nov-06 14:14 
Questiondatarow and dataset Pin
Mohammed Elkholy7-Nov-06 13:06
Mohammed Elkholy7-Nov-06 13:06 
AnswerRe: datarow and dataset Pin
lainoo7-Nov-06 13:18
lainoo7-Nov-06 13:18 
QuestionData holder - design decision Pin
Glen Harvy7-Nov-06 10:41
Glen Harvy7-Nov-06 10:41 
AnswerRe: Data holder - design decision Pin
Christian Graus7-Nov-06 11:49
protectorChristian Graus7-Nov-06 11:49 
QuestionProblem with dataGridComboBoxColumn object in VC# 2005 Pin
hdv2127-Nov-06 10:37
hdv2127-Nov-06 10:37 
AnswerRe: Problem with dataGridComboBoxColumn object in VC# 2005 Pin
lainoo7-Nov-06 13:14
lainoo7-Nov-06 13:14 
I design a class to DataGridViewComboBoxColumn and OTHERS

when u want to bind data , u use :
ClassLibrary_Pharm.Class_ComboBindData.u_ComboBindData(dataGridComboBoxColumn,"PersonProperties",SqlConnectionstring);

follow is my project code, u can modify it

using System;
using System.Collections.Generic;
using System.Text;
using System.Windows.Forms;
using System.Data;

namespace ClassLibrary_Pharm
{
public static class Class_ComboBindData
{
public static bool u_ComboBindData(object combo, string sTopic)
{
return u_ComboBindData(combo, sTopic, null);
}
public static bool u_ComboBindData(object combo, string sTopic, EcareHis.C.Common.His_LogOn Logon)
{
bool blReturn = false;
DataSet ds = null;
switch (sTopic.ToLower().Trim())
{
case "sex":
ds = u_GetSexual();
break;
case "stay":
ds = u_GetStay();
break;
case "readyflag":
ds = u_GetConfect();
break;
case "department":
ds = u_GetDeptEmp(Logon,"epr");
break;
case "code213":
ds = u_GetCodeTable(Logon, "realhis","code213");
break;
case "code211":
ds = u_GetCodeTable(Logon, "realhis", "code211");
break;
case "code212":
ds = u_GetCodeTable(Logon, "realhis", "code212");
break;
}
if (ds == null) throw new Exception("not rows" + sTopic);
if (ds.Tables["param"].Rows.Count < 1) throw new Exception("row count < 1" + sTopic);
switch (combo.GetType().ToString())
{
case "System.Windows.Forms.ComboBox":
((ComboBox)combo).DataSource = ds.Tables["param"];
((ComboBox)combo).ValueMember = "value";
((ComboBox)combo).DisplayMember = "mark";
break;
case "System.Windows.Forms.DataGridViewComboBoxColumn":
((DataGridViewComboBoxColumn)combo).DataSource = ds.Tables["param"];
((DataGridViewComboBoxColumn)combo).ValueMember = "value";
((DataGridViewComboBoxColumn)combo).DisplayMember = "mark";
break;
default:
throw new Exception("ClassType is not Valid");
break;
}
blReturn = true;
return blReturn;
}
private static DataSet u_GetSexual()
{
DataSet ds = new DataSet();
DataTable newTable = new DataTable("param");
newTable.Columns.Add("mark", typeof(string));
newTable.Columns.Add("value", typeof(string));
DataRow dr = newTable.NewRow();
dr["mark"] = "M";
dr["value"] = "M";
newTable.Rows.Add(dr);
dr = newTable.NewRow();
dr["mark"] = "F";
dr["value"] = "F";
newTable.Rows.Add(dr);
ds.Tables.Add(newTable);
return ds;
}
private static DataSet u_GetStay()
{
DataSet ds = new DataSet();
DataTable newTable = new DataTable("param");
newTable.Columns.Add("mark", typeof(string));
newTable.Columns.Add("value", typeof(string));

DataRow dr = newTable.NewRow();
dr["mark"] = "outpatient list ";
dr["value"] = "O";
newTable.Rows.Add(dr);
dr = newTable.NewRow();
dr["mark"] = "inpatient list";
dr["value"] = "I";
newTable.Rows.Add(dr);
ds.Tables.Add(newTable);
return ds;
}
private static DataSet u_GetConfect()
{
DataSet ds = new DataSet();
DataTable newTable = new DataTable("param");
newTable.Columns.Add("mark", typeof(string));
newTable.Columns.Add("value", typeof(string));

DataRow dr = newTable.NewRow();
dr["mark"] = "Config";
dr["value"] = "0";
newTable.Rows.Add(dr);
dr = newTable.NewRow();
dr["mark"] = "Dont config";
dr["value"] = "1";
newTable.Rows.Add(dr);
ds.Tables.Add(newTable);
return ds;
}
private static DataSet u_GetDeptEmp(EcareHis.C.Common.His_LogOn Logon,string sDatabase)
{
DataSet ds;
try
{
string sSelectSql = "select 'mark'=name,'value'=empid from emp where deptid='" + Logon.LogDeptid + "' and useflag='Y'";
ds = Logon.u_SqlLocate(sSelectSql, "param", sDatabase);
}
catch (Exception e1)
{
throw new Exception(e1.Message);
}
return ds;
}
private static DataSet u_GetCodeTable(EcareHis.C.Common.His_LogOn Logon, string sDatabase,string stableName)
{
DataSet ds;
try
{
string sSelectSql = "select 'mark'=rtrim(remark),'value'=rtrim(code) from "+stableName;
ds = Logon.u_SqlLocate(sSelectSql, "param", sDatabase);
}
catch (Exception e1)
{
throw new Exception(e1.Message);
}
return ds;
}
}
}


Sorry ...

QuestionIBindingList implementation Pin
bertvan7-Nov-06 10:05
bertvan7-Nov-06 10:05 
AnswerRe: IBindingList implementation Pin
Robert Rohde7-Nov-06 12:51
Robert Rohde7-Nov-06 12:51 
AnswerRe: IBindingList implementation Pin
Ed.Poore7-Nov-06 13:49
Ed.Poore7-Nov-06 13:49 
QuestionImage as Embedded Resource... [modified] Pin
new_phoenix7-Nov-06 7:16
new_phoenix7-Nov-06 7:16 
AnswerRe: Image as Embedded Resource... Pin
Scott Dorman7-Nov-06 8:05
professionalScott Dorman7-Nov-06 8:05 
AnswerRe: Image as Embedded Resource... Pin
Christian Graus7-Nov-06 9:11
protectorChristian Graus7-Nov-06 9:11 
Questionhow to change sound to byte and byte to sound? Pin
bahman2000b7-Nov-06 6:01
bahman2000b7-Nov-06 6:01 
AnswerRe: how to change sound to byte and byte to sound? Pin
Luc Pattyn7-Nov-06 7:46
sitebuilderLuc Pattyn7-Nov-06 7:46 
QuestionIrDAClient Pin
G_Me7-Nov-06 4:27
G_Me7-Nov-06 4:27 
QuestionPermanently set window to bottom? Pin
Muntyness7-Nov-06 3:29
Muntyness7-Nov-06 3:29 
AnswerRe: Permanently set window to bottom? Pin
Pete O'Hanlon7-Nov-06 4:58
mvePete O'Hanlon7-Nov-06 4:58 
GeneralRe: Permanently set window to bottom? Pin
Muntyness7-Nov-06 5:21
Muntyness7-Nov-06 5:21 
Questionaspx: setting the selection in a TextBox control Pin
Christopher Duncan7-Nov-06 3:14
Christopher Duncan7-Nov-06 3:14 
AnswerRe: aspx: setting the selection in a TextBox control Pin
coolestCoder7-Nov-06 3:47
coolestCoder7-Nov-06 3:47 
Questionchange permission in registry Pin
ingsgr01@gmail.com7-Nov-06 2:17
ingsgr01@gmail.com7-Nov-06 2:17 
AnswerRe: change permission in registry Pin
ednrgc7-Nov-06 6:25
ednrgc7-Nov-06 6:25 
Questionn00b question: change the height of an already open form Pin
blackpenny157-Nov-06 2:15
blackpenny157-Nov-06 2:15 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.