|
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
|
|
|
|
|
Indexes you have to manage yourself (I looked into implementing the same thing), if you look at the source code in Reflector (if you can get your head around the way things have been implemented), then you'll see that (I think it was anyway) AddIndex will throw a NotImplemented exception.
You basically have to manage your own indexes, I seem to remember there was one method which you could override which would be fired when anything changed. Can't remember the name of it but if you want it I can dig it up tomorrow sometime when I put the other disk back in (and when I have time).
Possibly the simplest way to maintain indexes is to have a dictionary object to provide looking up the indexes. Maybe, I'm not sure though. There doesn't seem to be very much documentation on the subject at all.
Don't hesitate to ask if you want further help as I did spend quite a bit of time figuring out what was going on (just got to remember what it was ).
Formula 1 - Short for "F1 Racing" - named after the standard "help" key in Windows, it's a sport where participants desperately search through software help files trying to find actual documentation. It's tedious and somewhat cruel, most matches ending in a draw as no participant is able to find anything helpful. - Shog9
Ed
|
|
|
|
|
After importing an image into a C# windows based application, and changing the "Build Action" from the default of "Content" to "Embedded Resource", and attempting to overwrite the image file from outside the application as a windows operation, the image replacement does not appear to be re-embedded as a resource thereby replacing the original image. Is the reason because the image file is embedded at the time that the application is compiled as a build? Is there some way that the new image file could be programmatically re-embedded as a resource through the manipulation of an image file property from inside the application?
Would really appreciate some insights as to the correct approach. The idea of embedding the image file as a resource is a good one, but I would like to be able to dynamically overwrite that image file and to re-embed it at run-time.
Also, it appears that the path to the image file when importing it into an application is unable to be modified from the default path of "C:/Documents and Settings/Administrator/My Documents/Visual Studio Projects/". Granted, this path can be set in the "Tools > Options > Environment > Projects and Solutions" settings section. However, can this default path be changed to a different directory for just the image files or is it locked in place with respect to the entire application's directory location? If the directory path cannot be modified, then I believe that it would really limit the placement for these image files in the application.
I suspect that the image file is embedded in binary format, but this should be able to be done dynamically on the fly. Any ideas or suggestions would be appreciated.
|
|
|
|
|
Importing an image (or any resource) in the manner you describe embeds the resource at compile time into the resulting binary. The only way to change the embedded resource is to recompile the application. The only way to do this programmatically at run-time would be to use CodeDom and reflection to emit a new DLL that contains the updated image.
Why would you want to be able to change this at runtime? Typically, if you are embedding a resource like this it is to prevent the end-user from changing it. One solution would be to check if an "override" file is found (a file with a specific name and directory location, and possibly other specifications as well) and, if so, use that override file; otherwise the embedded image would be used.
I'm not sure about the path issue you mention...someone else will need to comment on that one.
-----------------------------
In just two days, tomorrow will be yesterday.
|
|
|
|
|
One thing you can do if you want to be able to change your embedded image, is put resources in a dll, which you can then recompile and drop in to your projec.
Christian Graus - Microsoft MVP - C++
Metal Musings - Rex and my new metal blog
|
|
|
|