|
|
I have not messagebox result and I really want to use it.
when I type it , it dosen't apear. I search and I find this
public enum messageboxresult
but I didn't khnow how to use it.
|
|
|
|
|
Here is an example of how to get the result from a message box.
private void doSomething()
{
DialogResult theResult = MessageBox.Show("Is this working?", "Well.......",MessageBoxButtons.YesNo,MessageBoxIcon.Question);
if (theResult == DialogResult.Yes)
{
}
}
|
|
|
|
|
In yes or no, this can be use
if (MessageBox.Show("Is this working?", "Well.......", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes)
{
}
else
{
}
TVMU^P[[IGIOQHG^JSH`A#@`RFJ\c^JPL>;"[,*/|+&WLEZGc`AFXc!L
%^]*IRXD#@GKCQ`R\^SF_WcHbORY87֦ʻ6ϣN8ȤBcRAV\Z^&SU~%CSWQ@#2
W_AD`EPABIKRDFVS)EVLQK)JKQUFK[M`UKs*$GwU#QDXBER@CBN%
R0~53%eYrd8mt^7Z6]iTF+(EWfJ9zaK-iTV.C\y<pjxsg-b$f4ia>
-----------------------------------------------
128 bit encrypted signature, crack if you can
|
|
|
|
|
MessageBoxButton buttons = MessageBoxButton.OKCancel;
MessageBoxImage icon = MessageBoxImage.Information;
MessageBoxResult defaultResult = MessageBoxResult.OK;
MessageBoxResult result = MessageBox.Show(message, caption, buttons, icon, defaultResult);
This is however available only in .Net framework 3 and above.
See here.
Quidquid latine dictum sit, altum videtur.
Whatever is said in Latin sounds profound.
|
|
|
|
|
if (DialogResult.Yes == MessageBox.Show("test", "ask", MessageBoxButtons.YesNo, MessageBoxIcon.Information))
{
}
|
|
|
|
|
http://infynet.wordpress.com/2010/08/28/check-message-box-result
hi check this link.
|
|
|
|
|
http://infynet.wordpress.com/2010/08/28/check-message-box-result
hi check this link
|
|
|
|
|
I have a cell (cellIndex:5 and its in edit mode) that user must enter data in it then can go forword to next cell but if user didnt enter any data can only step back(I mean that user can go to all the cells before this Cell, for this example user can go to indexNumbers<5)and if the user didnt enter data must prevent from going to next cell and even next Row.
So please Help out !
|
|
|
|
|
Keep the columns ahead of current one disabled i.e. if user can enter data in column 5 only after entering some data in column 4, keep column 5 disabled initially. Have CellValidating event handler for the DataGridView. In that check for the value in the current cell. If user has entered value in it, enable the columns where user can edit/enter data.
|
|
|
|
|
Thanks for reply
But i want that user be able to go backword even if didnt entered any data in column 5.
|
|
|
|
|
You need something like this in the CellValidating event:
DataGridView dataGridView = sender as DataGridView;
dataGridView.Columns[5].ReadOnly = (e.ColumnIndex == 4 && string.IsNullOrEmpty(e.FormattedValue.ToString()));
User can move to any cell but the editing will be enabled only when the data is entered in the fourth cell.
|
|
|
|
|
Thanks that good but I also want to prevent user from move to next row and also Next cell too.
So now what!
I my self have done the But no use !
Plzzzzz Helpppppppp !
modified on Saturday, June 19, 2010 11:47 PM
|
|
|
|
|
Hi CodeProject.com World!
From My subject u can understand my question
But i will repeat my question in another way also :
Q:
I am attempting to detect a Shift+Tab in the KeyPress event for back
navigation on a Datagridview.
Have any ideas how to compare e.KeyChar to a ShiftTab?
modified on Sunday, June 20, 2010 1:48 PM
|
|
|
|
|
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)
|
|
|
|