|
KeyPress event is for the typeable character keys. You can use KeyDown or ProcessCmdKey .
For KeyDown you can check the Shift property of KeyEventArgs[^].
Alternatively you can override the ProcessCmdKey[^] method like this:
protected override bool ProcessCmdKey(ref Message msg, Keys keyData)
{
if (keyData == (Keys.Shift | Keys.Tab))
{
return true;
}
return base.ProcessCmdKey(ref msg, keyData);
}
|
|
|
|
|
|
I've been trying to find a pattern in the CP1252 to predict that value, but I haven't had much luck this morning. It must be too early.
Why not just write the KeyPressed handler to show the value returned, then press the key combination to see what pops up? That's how I tackle such problems, and you'd have your answer in about as much time as it took to write the question.
"A Journey of a Thousand Rest Stops Begins with a Single Movement"
|
|
|
|
|
I knew that but i was in mistake and that was i use
if(e.Keys == Keys.Shift | Keys.Tab)
and it gives me error !
Thanks for reply
|
|
|
|
|
I have a funny problem with mu aboutf_form when i run the code in backhroundworker..
I am getting different errors every time I open the form and the funny thing that sometimes it will not give any error!!!
please help..
errors are:
Collection was modified; enumeration operation may not execute. and
Object is currently in use elsewhere.
and both comes on this line:
at Program.cs at Application.Run(new frmMain());
here is my code:
private void backgroundWorkerAbout_DoWork(object sender, DoWorkEventArgs e)
{
create_info("Application version", System.Windows.Forms.Application.ProductVersion);;
create_info("SQL Server version", sql_connection.ServerVersion);
create_info("Database version", "99999");
create_info("Server State", sql_connection.State.ToString());
create_info("Server Timeout", sql_connection.ConnectionTimeout.ToString());
create_info("Executable Path", System.Windows.Forms.Application.ExecutablePath);
create_info("Startup Path", System.Windows.Forms.Application.StartupPath);
create_info("Open Windows", System.Windows.Forms.Application.OpenForms.Count.ToString());
create_info("SmartCard Component Name", FileVersionInfo.GetVersionInfo(System.Windows.Forms.Application.StartupPath + "\\BahrainAPI.dll").FileName);
create_info("Startup Path", System.Windows.Forms.Application.StartupPath);
create_info("User Name", Environment.UserName);
create_info("Machine Name", Environment.MachineName);
create_info(Environment.OSVersion.VersionString.ToString(), Environment.OSVersion.Platform.ToString());
create_info("System Directory", Environment.SystemDirectory.ToString());
create_info("Domain Name", Environment.UserDomainName.ToString());
create_info("Current Directory", Environment.CurrentDirectory.ToString());
}
private void frmAbout_Shown(object sender, EventArgs e)
{
this.Cursor = Cursors.WaitCursor;
lblCopyrights.Text = "Copyright © 2010";
sql_connection = new SqlConnection((string)public_var._system_parameters_hash["SQL_SERVER_CONNECTION"]);
sql_connection.Open();
progressAbout.Visible = true; progressAbout.Refresh();
gridAbout.Visible = true; gridAbout.Refresh();
backgroundWorkerAbout.RunWorkerAsync();
this.Cursor = Cursors.Default;
}
private void create_info(string info_header, string info_value)
{
about_row = new DevExpress.XtraVerticalGrid.Rows.EditorRow();
about_row.Name = Guid.NewGuid().ToString();
about_row.OptionsRow.AllowMove = false;
about_row.OptionsRow.AllowMoveToCustomizationForm = false;
about_row.OptionsRow.ShowInCustomizationForm = false;
about_row.Properties.Caption = info_header;
about_row.Properties.Value = info_value;
about_row.Properties.ReadOnly = true;
gridAbout.Rows.Add(about_row);
}
|
|
|
|
|
your description is not clear:
1. the symptoms are not described clearly
2. some essential information is missing, such as the declaration and set-up of gridAbout
Anyway, I have these remarks:
1. you should not touch GUI parts from any thread other than the main thread (or the ProgressReport/RunWorkCompeleted handlers of a BGW created by the main thread); a BGW's DoWork is running on another thread.
2. You should check BGW.Error in BGW.RunWorkCompleted for more information
3. The things you have in BGW.DoWork don't block at all, they could as well be executed on the main thread.
4. If you insist on updating the GUI from inside BGW.DoWork without relying on ProgressReport, you'd need this[^].
|
|
|
|
|
hello, this may have been asked before but i am still having trouble with getting a string onto another form, i have searched google etc and still don't get it as many differant articles tell you differant things etc ...
all i need to do is get my string from form 2 to form 1.....
my code for my string .....
string findme = txtfind.Text;
thanks
|
|
|
|
|
Form1.textVar.Text = findme;
It's time for a new signature.
modified on Saturday, June 19, 2010 8:12 AM
|
|
|
|
|
|
There are a lot of possible ways and a lot of possible scenaries where you transfer a string from the one form to another. A very simple way is to associate the both form. That means, that form 1 has a instance for form 2 or reversed. So you have to make sure, that the properties from form 2 are public that you wan't to set from form 1.
Here a small example of a association of two forms:
public partial class Form1 : Form {
public Form2 Form2 { get; set; }
public Form1() {
InitializeComponent();
}
private void button1_Click(object sender, EventArgs e) {
Form2.MyStringIfWantToSet = "Hello World";
}
}
public partial class Form2 : Form {
public string MyStringIfWantToSet {
get {
return textBox1.Text;
}
set {
textBox1.Text = value;
}
}
public Form2() {
InitializeComponent();
}
}
[STAThread]
static void Main() {
Application.EnableVisualStyles();
Application.SetCompatibleTextRenderingDefault(false);
Form1 form1 = new Form1();
Form2 form2 = new Form2();
form1.Form2 = form2;
form2.Show();
Application.Run(form1);
}
I really hope i could help, sorry for my english...
|
|
|
|
|
A tip[^] that will give you the code...
An article[^] which will explain it and more.
DaveIf this helped, please vote & accept answer!
Binging is like googling, it just feels dirtier. (Pete O'Hanlon)
BTW, in software, hope and pray is not a viable strategy. (Luc Pattyn)
|
|
|
|
|
in form2 declare public property
public string FindText;
you can access this property, like this
string find = from1.FindText;
The big boss!
|
|
|
|
|
Thank you !!
|
|
|
|
|
Hi Everyone
I am new in C# and developing a desktop application using it. There I have developed a form. In that form a DataGridView control is used. In that control a lot number of column is added with header text manually. This result a Horizontal Scrollbar appeared when run the form. Now I would like to control that Horizontal Scrollbar bar by locking some column not to scroll from beginning to a certain index of column. After that index the rest of the columns will be scrolled horizontally. Please help me in this regard. Thanks to you all.
|
|
|
|
|
IMO you would need to set DataGridViewColumn.Frozen=true for all non-scrolling columns.
|
|
|
|
|
Hi,
I have a project which is used the interbase database.
Issue is, one column with datatype char(100) in a table. I will bind this column in grid when empty space also binded. I have used to ltrim(rtrim(Name)) function in SQL statment. It wouldnt affect.
How can i trim this empty space?
Thanks in advance.
|
|
|
|
|
Strange the SQL TRIM would not work
How ever , I will give you another solution , with code :
MyDataTable = New DataTable ();
SqlConnect con = new SqlConnection ("connection string goes here ") ;
SqlDataAdapter SqlDa = new SqlDataAdapter ("SELECT * FROM myTable", conn);
SqlDa.Fill(myDataTable);
foreach ( DataRow dr in MyDataTable.Rows)
{
dr["ColumnName"] = dr["ColumnName"].toString().Trim();
}
Hope This Help ,
------------ Please Increase the hit's of my website by 1 : -----------
www.smart-arab.com
I know nothing , I know nothing ...
|
|
|
|
|
Thank you Stark DaFixzer.
I did try this code. But I have 10 million rows. So it will take more time to bind. Please any other solutions.
Thanks in Advance
Rameshkumar
|
|
|
|
|
I Think that there is a hidden Character at the end of your string that you try trim
try to copy the value and paste it , in a word application , OR notepad++ ,
then press ( Show All Character Button ) it's looks like ( ¶ )
---- IF you found a hidden chars , which is not a space , then you can remove this char
by updating all your records , and re-use the LTRIM (RTRIM) Function again
Hope this help ,
Kind regards
I know nothing , I know nothing ...
|
|
|
|
|
Hi Stark DaFixzer,
I checked that table. There is no empty space and special characters.
Please any other way to trim the values.
Thanks in Advance
Rameshkumar.T
|
|
|
|
|
Hi Stark DaFixzer,
I got a solution for trim the values using LINQ. The following statementi have used in my application.
var NameList = (from param_enum_desc in dsPartnertype.Tables[0].AsEnumerable()
select new
{
POS_VALUE = param_enum_desc.Field<string>("POS_VALUE"),
POS_DESCR = param_enum_desc.Field<string>("POS_DESCR")
});
stoPartner.DataSource = NameList;
stoPartner.DataBind();
Thank you
Rameshkumar.T
|
|
|
|
|
Hi Stark DaFixzer,
sorry i forgot trim method to end of the statement.
var NameList = (from param_enum_desc in dsPartnertype.Tables[0].AsEnumerable()
select new
{
POS_VALUE = param_enum_desc.Field<string>("POS_VALUE").Trim(),
POS_DESCR = param_enum_desc.Field<string>("POS_DESCR").Trim()
});
stoPartner.DataSource = NameList;
stoPartner.DataBind();
Thank you
Rameshkumar.T
|
|
|
|
|
I need to convert the HTML Page into multiple Metafile without any partial clipping of the text at the bottom of the images. I am using IviewObject's Draw method to capture the HTML page as Metafile. I have tried to avoid text breaking by using the IHTMLElement class and compared the element position with the region height and skipped the element to the Next image if it was not fully preserved within the region to be clipped, but it doesn't seems to be working. Any help on this...
modified on Saturday, June 19, 2010 4:43 AM
|
|
|
|
|
I think it might help if you rephrase this as a question - asking something specific, perhaps about some code, and showing what you've done so far .. if you dont have a place to start, you may have to google a bit first
.. as it is, its likely only to get disdainful responses
'g'
|
|
|
|
|
I have an application with crystal reports. while loading the reports its prompting for the database login entities. How to disable the login prompt in crystal reports???
|
|
|
|