|
This is the winforms application.
i'm getting error in program.cs file.
when i close the form it is giving the following exception.
System.ObjectDisposedException was unhandled
Message="Cannot access a disposed object.\r\nObject name: 'frmChkStatus'."
Source="System.Windows.Forms"
ObjectName="frmChkStatus"
StackTrace:
at System.Windows.Forms.Control.CreateHandle()
at System.Windows.Forms.Form.CreateHandle()
at System.Windows.Forms.Control.get_Handle()
at System.Windows.Forms.Control.SetVisibleCore(Boolean value)
at System.Windows.Forms.Form.SetVisibleCore(Boolean value)
at System.Windows.Forms.Control.set_Visible(Boolean value)
at System.Windows.Forms.Application.ThreadContext.RunMessageLoopInner(Int32 reason, ApplicationContext context)
at System.Windows.Forms.Application.ThreadContext.RunMessageLoop(Int32 reason, ApplicationContext context)
at System.Windows.Forms.Application.Run(Form mainForm)
at CheckStatus.Program.Main() in C:\Documents and Settings\MedikonM\My Documents\Visual Studio 2005\Projects\CheckStatus\CheckStatus\Program.cs:line 22
at System.AppDomain.nExecuteAssembly(Assembly assembly, String[] args)
at System.AppDomain.ExecuteAssembly(String assemblyFile, Evidence assemblySecurity, String[] args)
at Microsoft.VisualStudio.HostingProcess.HostProc.RunUsersAssembly()
at System.Threading.ThreadHelper.ThreadStart_Context(Object state)
at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
at System.Threading.ThreadHelper.ThreadStart()
in short the exception is
ObjectDisposedException was unhandled.
Cannot access a disposed object.
Object name: 'frmChkStatus'.
M.MohanVamsi
|
|
|
|
|
Application.Run(new frmChkStatus());
during this peice of code i'm getting error. this code is in program.cs in static void Main()
M.MohanVamsi
|
|
|
|
|
Ok. Looking at all the code in the OP, all that code was in the forms constructor. What does your code for closing the form in frmChkStatus_Load look like?
"If an Indian asked a programming question in the forest, would it still be urgent?" - John Simmons / outlaw programmer
I get all the news I need from the weather report - Paul Simon (from "The Only Living Boy in New York")
|
|
|
|
|
there is no code in the form load event. initially when the form loads itself it has to connect to database and check whether there is any records or not.
if there is no records then exe has to close with out loading the form.
that is my requirement.
M.MohanVamsi
|
|
|
|
|
Hi
I have a form which is being used by a user to send an e-mail.
the problem I have is thta if a user clicks enter whilst in the textbox(message) then the e-mail form is submitted.
Bascially when they press enter I want them to be able to move onto the next line of the textbox not send the message
cheers
|
|
|
|
|
You need to set both Multiline and AcceptsReturn to true .
Hope this helps.
Matthew Butler
|
|
|
|
|
when i try that in c# it says that the textbox does not contain a defintion for accepts return
code:
tb_message.AcceptsReturn = true;
any more suggestions?
|
|
|
|
|
I'm not sure why it doesn't exist: (I've just tried it successfully compiling under .Net 2.0).
I am assuming when you say 'TextBox'... you are refering to System.Windows.Forms.TextBox not a System.Windows.Forms.RichTextBox .
If you are using a RichTextBox:
On the form (where the enter button is) there will be a property called AcceptButton ... set this to null.
Otherwise I can't help you.
Matthew Butler
|
|
|
|
|
its using System.Web.UI.WebControls;
is this what you mean?
its not a richtextbox
thanks so far
|
|
|
|
|
In that case:
tb_message.TextMode = TextBoxMode.MultiLine;
This should work. (But I've never used web controls so it might not).
Matthew Butler
|
|
|
|
|
hi that worked!!
but how would i use: AcceptsReturn
i cant find the right bit of code that works for web controls
thanks so far!!
|
|
|
|
|
AcceptsReturn is only for System.Windows.Forms.TextBox (not Forms.RichTextBox or the WebControls.TextBox).
Setting TextMode to MultiLine should be the only thing you need to do.
Matthew Butler
|
|
|
|
|
no I am afraid that doesnt work, the form still sends even if i put in the bit of code you posted, thanks anyway i will keep trying
|
|
|
|
|
HI, I am new to C#. I am working on a software that uses oracle as its database. As I am new to this environment It is getting difficult for me to find things out.
I have connected to my database in Oracle which name is DBA.I can add ,delete, update data now.But I am facing difficulty to retrieve values of next row or previous row or first row or last row.
It would be really helpful for me if any one can tell me what code should I write under those four buttons.
|
|
|
|
|
Saiyed Alam wrote: HI, I am new to C#. I am working on a software that uses oracle as its database. As I am new to this environment It is getting difficult for me to find things out.
I have connected to my database in Oracle which name is DBA.I can add ,delete, update data now.But I am facing difficulty to retrieve values of next row or previous row or first row or last row.
It would be really helpful for me if any one can tell me what code should I write under those four buttons.
I am not sure I understand your problem. Are you getting your row directly from your database? Or are you populating your table into a DataTable in C#? If you are not loading your rows into a DataTable I recommend you do that.
"If an Indian asked a programming question in the forest, would it still be urgent?" - John Simmons / outlaw programmer
I get all the news I need from the weather report - Paul Simon (from "The Only Living Boy in New York")
|
|
|
|
|
Hi, thank u, I meant I am failing to watch the values of the table. I want to show the values of each row in separate text boxes. How can I do that?
|
|
|
|
|
i need to make method pass number integer as 3 and print on screan 3 2 1 0 1 2 3
but not use loop at the method and not return any value
123
|
|
|
|
|
Well, you could do this:
private void PrintNumbers(int number)
{
Console.WriteLine("3 2 1 0 1 2 3");
} And then call it with PrintNumbers(3);
Alternatively, you could do this with a recursive method call.
|
|
|
|
|
Pete O'Hanlon wrote: you could do this with a recursive method call
a recursion with a method that "does not return a value"?
so a class member would be used to make things ugly. What will they come up with next?
|
|
|
|
|
It's quite possible to solve this in a recursive manner without having to use return values or class members.
To the Original Poster: I'm guessing the whole point of this exercise is to demonstrate that you understand recursion. If you don't, then it's probably worth re-reading your course notes, as you won't learn anything if we just tell you the answer (which is incredibly simple.)
|
|
|
|
|
but you don't know what number maybe 3 or 4 or 18 ...etc
123
|
|
|
|
|
It's not my fault that your specification was vague. You asked " need to make method pass number integer as 3 and print on screan 3 2 1 0 1 2 3
but not use loop at the method and not return any value" and I gave you a method to do that. I'm not responsible for your scope creep.
|
|
|
|
|
Pete O'Hanlon wrote: I'm not responsible for your scope creep.
Genuine LOL
|
|
|
|
|
In that case...
private void PrintNumbers(int number)
{
if( number == 3 )
{
Console.WriteLine("3 2 1 0 1 2 3");
}
else if( number == 4 )
{
Console.WriteLine("4 3 2 1 0 1 2 3 4");
}
else if( number == 18 )
{
Console.WriteLine("18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18");
}
else
{
Console.WriteLine("Invalid argument");
}
}
|
|
|
|
|
SVb.net wrote: but not use loop at the method and not return any value
I want this nail banged into this drywall, but you're not to use a hammer and you're not allowed to use the end of a screwdriver either!
Whatever will this stupid teachers come up with next?
|
|
|
|