|
I know there is no input box class in C# and we have to either import it from VB or write a custom input box.
But currently while I'm working with my program, it is an excel-like program with a grid table on the GUI, user can enter data into any cell on that (like an excel sheet), I come across a problem that whenever I call the input box to display, the currently selected cell will lose all its data.
I tried both the input box from VB and made a new form to display my custom input box, but the problem is still the same.
Can anyone help me identify why this happen ? I really have no idea why pop up a new form would make the currently selected cell in current form lose all the data, especially when the other cells remained unchanged.
Regards
|
|
|
|
|
What's wrong with a textbox ? What on earth is an inport box, that you need to import it from VB ?
Christian Graus - Microsoft MVP - C++
Metal Musings - Rex and my new metal blog
"I am working on a project that will convert a FORTRAN code to corresponding C++ code.I am not aware of FORTRAN syntax" ( spotted in the C++/CLI forum )
|
|
|
|
|
Well there is really nothing wrong with a text box, but I don't need a text box here.
What I need is a pop up box to ask user input something and allow them to confirm/cancel with button, and that's why I need an Input box
|
|
|
|
|
OK, then you need to create a form that does that.
Christian Graus - Microsoft MVP - C++
Metal Musings - Rex and my new metal blog
"I am working on a project that will convert a FORTRAN code to corresponding C++ code.I am not aware of FORTRAN syntax" ( spotted in the C++/CLI forum )
|
|
|
|
|
Please read my original post again.
I do know that I need to create a form to do that, and I already did. But the problem is that whenever I call that form, my cell data got erased.
|
|
|
|
|
Hello,
Are you passing information to that form, like the instance of your control?
Give us more information what this form is doing.
All the best,
Martin
|
|
|
|
|
This is all I do with that input box, I don't pass in any control
InputBoxResult result = InputBox.Show("Enter alias:", "Some title", "Default", new InputBoxValidatingHandler(inputBox_Validating));
InputBoxResult is a class that have a boolean value for validating input and a text value for input string.
Here is the method that I use to show the form:
public static InputBoxResult Show(string prompt, string title, string defaultResponse, InputBoxValidatingHandler validator, int xpos, int ypos) {
using (InputBox form = new InputBox()) {
form.labelPrompt.Text = prompt;
form.Text = title;
form.textBoxText.Text = defaultResponse;
if (xpos >= 0 && ypos >= 0) {
form.StartPosition = FormStartPosition.Manual;
form.Left = xpos;
form.Top = ypos;
}
form.Validator = validator;
DialogResult result = form.ShowDialog();
InputBoxResult retval = new InputBoxResult();
if (result == DialogResult.OK) {
retval.Text = form.textBoxText.Text;
retval.OK = true;
}
return retval;
}
}
I want to get this input string and set it as the cell alias. Well I can get that string, but whenever the form pop up, my cell goes empty
|
|
|
|
|
Hello,
thailehuy wrote: new InputBoxValidatingHandler
What is the handler doing?
From which event are you calling the Show method?
All the best,
Martin
|
|
|
|
|
The handler does not do anything in particular, but call this method:
private void textBoxText_Validating(object sender, System.ComponentModel.CancelEventArgs e) {
if (Validator != null) {
InputBoxValidatingArgs args = new InputBoxValidatingArgs();
args.Text = textBoxText.Text;
Validator(this, args);
if (args.Cancel) {
e.Cancel = true;
errorProviderText.SetError(textBoxText, args.Message);
}
}
InputBoxValidatingArgs and Validator are some other classes and variables that store values
The Show method is called whenever user click a button or a menu item
|
|
|
|
|
thailehuy wrote: I do know that I need to create a form to do that, and I already did.
OK, I thought you said you were importing some VB thing instead.
thailehuy wrote: But the problem is that whenever I call that form, my cell data got erased.
OK, it's impossible to help you without seeing some code.
Christian Graus - Microsoft MVP - C++
Metal Musings - Rex and my new metal blog
"I am working on a project that will convert a FORTRAN code to corresponding C++ code.I am not aware of FORTRAN syntax" ( spotted in the C++/CLI forum )
|
|
|
|
|
Hi,
I am using OLEDB for reading excel data.Although it's working fine but unable to read values of some cell e.g. i have data in A1,A2,A3 cells.
my program is successfully reading data of cell A1 but unable to read data from cells A2,A3. i have checked all but unable to find the cause.when i applied watch on table. Its showing System.DBNull in cell A2 and A3.
please help me ASAP
|
|
|
|
|
Do you have data in any other cells ? Perhaps you're not reading the cells you thin kyou are.
No-one can offer more concrete help without seeing your code.
Christian Graus - Microsoft MVP - C++
Metal Musings - Rex and my new metal blog
"I am working on a project that will convert a FORTRAN code to corresponding C++ code.I am not aware of FORTRAN syntax" ( spotted in the C++/CLI forum )
|
|
|
|
|
data is present in all cells. i think problem in the column data type
|
|
|
|
|
How do u read the data from cells?
Does the app always read first cell?
|
|
|
|
|
Hi All,
Please let me know how to invoke a method of an application in Windows service using Process Class of System.Diagnostics. I don't want to make use of Reflection.
// Get all instances of Application running on the local
Process[] localName = Process.GetProcessesByName("Application_Name");
foreach (Process proc in localName)
{
Console.WriteLine(proc.ToString());
Console.WriteLine(proc.Id);
Console.WriteLine(proc.GetType());
}
Using the above instance I have to call the method of the application.
Noor hussain
|
|
|
|
|
Then you need to load the assembly using the methods in the System.Reflection namespace, not get a set of processes in the system.
|
|
|
|
|
oConn.Open = "Provider=DB2OLEDB;" & _
"Network Transport Library=TCPIP;" & _
"Network Address=xxx.xxx.xxx.xxx;" & _
"Initial Catalog=MyCatalog;" & _
"Package Collection=MyPackageCollection;" & _
"Default Schema=MySchema;" & _
"User ID=MyUsername;" & _
"Password=MyPassword"
this is the connection string i got from a site. How will apply it in my program:
OleDbConnection connect=new OleDbConnection();
connect.ConnectionString="Provider=DB2OLEDB; initial catalog=SAMPLE;integrated security=SSPI,default schema=jefoy";
connect.Open();
OleDbCommand cmd_save =new OleDbCommand("INSERT INTO test(name,year,course)"+"VALUES("+"'"+textBox1.Text+"'"+","+"'"+textBox2.Text+"'"+","+"'"+textBox3.Text+"'"+")",connect);
cmd_save.ExecuteNonQuery();
connect.Close();
will i place it as it is or will i change the schemas and the other items? its not working. Maybe somethings wrong. Thanks...
|
|
|
|
|
Hi,
No need to write Default Schema.
Eithr u use Upper haft part or lower half part. Give User id and Password in lower part of connection string. Then Take a Integer vriable as
int intRow=cmd_save.ExecuteNonQuery();
if(intRow>0)
{
"Record Updated"
}
Note: ExecuteNonQuery returns number of rows affected.
Binod K.
|
|
|
|
|
OleDbConnection connect=new OleDbConnection();
connect.ConnectionString="Provider=DB2OLEDB; initial catalog=SAMPLE;integrated security=SSPI,user id=db2admin;password=eugene09";
connect.Open();
OleDbCommand cmd_save =new OleDbCommand("INSERT INTO test(name,year,course)"+"VALUES("+"'"+textBox1.Text+"'"+","+"'"+textBox2.Text+"'"+","+"'"+textBox3.Text+"'"+")",connect);
int intRow=cmd_save.ExecuteNonQuery();
if(intRow>0)
{
MessageBox.Show("Record added");
}
connect.Close();
this is a program i created adding a record in the database but their is no error but an exception, saying " DB2OLEDB is not existing in the local machine."
i think the problem is in the insert command. thanks for all the help!
|
|
|
|
|
On closing a .Net 2.0 windows application exe i get the following error.
The instruction at "0x7c9118d0" referenced memory at "0x00000000". The memory could not be "written".
While closing the application , i start another process using System.Diagnostics.Process class.
What can be the reason for this error?
Also this is not a consistent behavior.
Thanks.
|
|
|
|
|
Are you using any third party components? Or a taskbar/tasktray type component?
The only way to speed up a Macintosh computer is at 9.8 m/sec/sec.
|
|
|
|
|
Implement the following and it will show the exception that is occurring:
///
/// The main entry point for the application.
///
[STAThread]
static void Main()
{
// Connect to the unhandled exception event
AppDomain.CurrentDomain.UnhandledException += new UnhandledExceptionEventHandler(CurrentDomain_UnhandledException);
Application.EnableVisualStyles();
Application.SetCompatibleTextRenderingDefault(false);
Application.Run(new TestApp());
// Disconnect from the unhandled exception event
AppDomain.CurrentDomain.UnhandledException -= new UnhandledExceptionEventHandler(CurrentDomain_UnhandledException);
}
static void CurrentDomain_UnhandledException(object sender, UnhandledExceptionEventArgs e)
{
// Show the exception to the user. This could be written
// to a file, but since this is just a test app...
MessageBox.Show(e.ExceptionObject.ToString());
if (!e.IsTerminating)
Application.Exit();
}
Phil
|
|
|
|
|
Hi,
I'm currently working with user controls under VS2005.
VS2005 does provide a handy tool called "UserControl TestContainer" for every user controls in my project.
However, I need to configure one of my user controls in the project to be the first one to display.
The problem here is that I'm using a third party control and it doesn't render correctly if its parent form is not the first one to be rendered. So I need a way to set the form as a startup user control.
Is there any way to do that?
Thank you very much.
KiT
Never wait for a chance to come, Believe in your own potential and go get it!
|
|
|
|
|
None that I know of, I'm afraid.
|
|
|
|
|
Good day,
I have a user control. My user control is customize Panel which can be minimize or maximize. I use Transparent as background of my control.
I tried to test my new control under a form that has a background picture. When I run my test program, i've tried to minimize my user control Panel but the area that was left behind by my panel is NOT the background image picture of the form where i put my user control instead the trasparent color appear.
Is there a way that we could get the background of the Area what was overlapped by my user control ? How can I make my user control aware of the background area that it overlapped at design time so that I could restore that area when my control is minimize?
Any suggestions would be appreciated.
Thanks,
|
|
|
|