|
Dear friends,
I have one simple user control in my web based application with five buttons.
When i used it on the webforms of my application as a user control it does not give me the events for Save, Delete, Add etc.
Please can some one help me out in this matter how to raise event on the webform with the user control. Your quick response will be highly appreciated.
Thanks
Murtuza
|
|
|
|
|
There are no events for save/delete/add, unless you're using a grid control that offers them.
You probably need to define your problem more. If your control needs to pass events to the main form, you need to hook them up in the form.
Christian Graus - Microsoft MVP - C++
Metal Musings - Rex and my new metal blog
|
|
|
|
|
Hi
i am trying to check for the existance of a directory using C# but don't know exact format to use it.
My.Computer.FileSystem.DirectoryExists("C:\\directoryname")
can someone help me by guiding me to the exact way of knowing the existance of directory.
regards
sAqIb
"Our scientific power has outrun our spiritual power. We have guided missiles and misguided men."
Dr. Martin Luther King Jr.
|
|
|
|
|
hi!
try this
DirectoryInfo dr1 = new DirectoryInfo("c:\\dirname");
if (dr1.Exists)
{
MessageBox.Show("Directory Exists")
}
abhinav
|
|
|
|
|
saqib82 wrote: My.Computer.FileSystem.DirectoryExists("C:\\directoryname")
This is VB, VB has nasty shortcuts ( nasty because they don't flow to C# ).
if (System.IO.Directory.Exists(@"c:\Directoryname"))
{
// Whatever
}
The @ allows you to type \ without having to do \\
Christian Graus - Microsoft MVP - C++
Metal Musings - Rex and my new metal blog
|
|
|
|
|
Thanks christian, i was trying to do something like we do in vb. But finally i did the same thing that you have suggested. Sorry you are late, but thanks again for your help.
regards
sAqIb
"Our scientific power has outrun our spiritual power. We have guided missiles and misguided men."
Dr. Martin Luther King Jr.
|
|
|
|
|
I have a problem in textbox i want when somebody enter a character in the textbox the textbox show another char (Unicode Char) for example if entered 'd' the textbox show 'h'(or Unicode char)
is there any Solution?
With Thanks
MHF
|
|
|
|
|
you can do so using the event of KeyUp. Do whatever you want to do in that event and as the user will write some character, that character will immediately be converted to your desired character
regards
sAqIb
"Our scientific power has outrun our spiritual power. We have guided missiles and misguided men."
Dr. Martin Luther King Jr.
|
|
|
|
|
Sorry but i can't understand exactly please give me a sample
With regards
MHf
|
|
|
|
|
I guess you are creating a textbox for custom non english language. Follow the following steps which will help you out.
<br />
- Derive a class from TextBox.<br />
- Override OnKeyPress protected function (This is called before character is displayed on the screen).<br />
- Read e.KeyChar.<br />
- And finally replace e.KeyChar with new character.<br />
Thats it...
|
|
|
|
|
But e.KeyChar is readonly ????
MHF
|
|
|
|
|
My project has to start a execute file : DPAPIAdminUtility.exe. When DPAPIAdminUtility.exe starts, there are many textbox to input data. Now I want to pass argument directly in code so that when DPAPIAdminUtility.exe start, every textbox will be filled by value I pass in code. So, how to know property name of each textbox? And how to pass argument by ini file? Could anyone help me. Thanks
|
|
|
|
|
u can pass arguments in following way
System.Diagnostics.Process.Start("complete path of exe to start","argument1,argument2,...");
rahul
|
|
|
|
|
I am not sure but i think you will not be able to pass arguments by ini file. you will haev to write code to read from ini file.
regards
sAqIb
"Our scientific power has outrun our spiritual power. We have guided missiles and misguided men."
Dr. Martin Luther King Jr.
|
|
|
|
|
Hi folks,
I've got a pair of classes (A and B), where A instantiates an instance of B. What I want to do is:
A.DoStuff();<br />
A.B.DoSomeStuff();<br />
A.DoMoreStuff();
The problem is that B.DoSomeStuff() is asynchronous, and A.DoMoreStuff is called before B is done with its processing. For my specific case, B is an instance of the WebBrowser object, and most of the processing happens in its DocumentComplete event handler.
It strikes me that I should create an event and an event handler, but for the life of me I've been unable to hook this all together successfully. Are events the way to go, or should I implement some type of callback mechanism here?
Any suggestions or pointers will be gratefully received.
Thanks,
Kevin
|
|
|
|
|
Do you want A.DoMoreStuff to be called after B.DoSomeStuff is complete?
If you do then add a call to A.DoMoreStuff(); in the DocumentComplete Handler.
I'm not sure i understand what you are trying to do exactly.
Russ
|
|
|
|
|
i wanna to read a file then know if it contain image then get text from image i dont know how???like ocr technique but i need a code or dll files using c# can anyone help??
SUMA
|
|
|
|
|
How can i add and remove rows in datatable in dataset?
thanks for help
MD_NADA
|
|
|
|
|
add row :
DataRow dr=dataset.table["tablename"].newrow();
dr["columnname"]="value";
...
dataset.table["tablename"].rows.add(dr);
remove row:
dataset.table["tablename"].rows[row].remove();
if you want to add more rows from other datatable ,or remove mores rows ,
you can use while statement to do
Sorry ...
|
|
|
|
|
Hi,
I need to create a list of email addresses from either a database source OR manually entered email addresses and then use those addresses to .. wait for it .. send emails
The list could be just one address or possibly hundreds.
What are your recommendations on what format the list should take. I'm thinking of a datatable but is there a better (meaning efficient) suggestion.
Thanks,
Glen Harvy
|
|
|
|
|
If it's just a list, I'd use List<string>
Christian Graus - Microsoft MVP - C++
Metal Musings - Rex and my new metal blog
|
|
|
|
|
hi
i was add dataGridComboBoxColumn in my datagridview and write this code to bind it to my column :
this.personPropertiesTableAdapter.Fill(this.dataSet_AddressBook.PersonProperties);<br />
dataGridComboBoxColumn.DataSource = this.dataSet_AddressBook.PersonProperties;<br />
dataGridComboBoxColumn.ValueMember = "CategoryName";
but when i fill dataset, value don't show in dataGridComboBoxColumn and i must select dataGridComboBoxColumn and select that value from combo list,but i want when i fill dataset,value show on dataGridComboBoxColumn,but how to do ?
thanks
|
|
|
|
|
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 ...
|
|
|
|
|
Hello,
I have a generic class BindingCollection<T> : IBindingList
The purpose of this class is to collect Business Objects and functionality around them (LoadAll, New ...). I implemented IBindingList so I could be able to bind it to a DataGridView (with BindingSource) and when changes occur to the BindingCollection, the DataGridView would notice and update itself and vice versa.
I think that so far, this is a logical setup, no?
Now I'm wondering how I should implement the IBindingList interface methods.
Should I make a class-variable BindingList<T> list and when, for example, AddIndex(...) is called, do something like
<br />
public void AddIndex(PropertyDescriptor property)<br />
{<br />
((IBindingList)list).AddIndex(property);<br />
}<br />
<br />
At the moment I implemented all interface methods in a similar way, but even though my inner list gets updated nicely, the DataGridView still doesn't notice any changes nor does it update it's presented data.
Any help would be very welcome, because I have been struggling with this problem for quite a while, and you could help me a lot further.
Greets, Bert
|
|
|
|
|
Hi,
have you bound the ListChanged event of the inner class? If not then do so and rethrow the event within your class.
Robert
|
|
|
|