|
Hi,
I recommend you try and understand what goes wrong, rather than look for another approach.
There is nothing wrong with the approach, so it must be in the details.
First and forall, look at the symptoms and describe them in full detail when asking this
kind of questions.
Did you check the content of Textbox1.Text? Add some code right where you need it,
and show the value to yourself. Do not assume everything is all-right, since it
clearly is not, otherwise you would not ask for help.
is it a valid number (no more no less)? is it empty? does it contain non-digits?
why don't you use a try-catch block and show the exception.ToString()?
that should tell a lot.
BTW: you should not draw things in a button click handler, anyway e.Graphics will not
be available there.
Seems to me you are a novice in C#, and could benefit a lot from buying and reading
in introductory book on C#.
Luc Pattyn [Forum Guidelines] [My Articles]
This month's tips:
- before you ask a question here, search CodeProject, then Google;
- the quality and detail of your question reflects on the effectiveness of the help you are likely to get;
- use PRE tags to preserve formatting when showing multi-line code snippets.
|
|
|
|
|
|
Neetu Maheshwari wrote: AdminInfo ad = new AdminInfo();
ad.MdiParent = this;
ad.Height = this.Height;
ad.Width = this.Width;
ad.Show();
updateProfileIsUp = true;
Assuming updateProfileIsUp is false , this should work. Everything appears to be good. The only question I have is why are you setting the height and width of the new child form to the same height and width as the parent form?? This would make the chiold form bigger than the MdiClient area of the parent form.
Is this handler being called at all?? Test it. Put a MsgBox line in the code to see if it pops up when you click the menu item. If not, the menu item Click event handler hasn't been wired up, or wired up improperly.
|
|
|
|
|
hi all
i have faced one problem in my windows application(c#,ms access).i am using backend as ms access.i have written code like this.
string s="datasource=C:\\cms\\cmsaccess.mdb";
string q="select * from users";
OledbConnection con=new OledbConnection(s);
OledbDataAdapter adp=new OledbDataAdapter(q,con);
DataSet ds=new DataSet();
adp.fill(ds,"users");
i have written like this in every form where ever i connected to database.but if i installed in server how the application access that database(C:\\cms\\cmsaccess.mdb) in clients .the database location may be changed in clients.i am facing this problem. this application must be run in network.please send solution for this problem.
thank you
regards
obalesu n
|
|
|
|
|
obalesu wrote: i have written like this in every form where ever i connected to database
Create a DAL - All database related code should go in one location. That location is called a DAL.
obalesu wrote: if i installed in server how the application access that database(C:\\cms\\cmsaccess.mdb) in clients .the database location may be changed in clients.i am facing this problem. this application must be run in network.please send solution for this problem.
Have you thought about using config files?
|
|
|
|
|
thanks for reply,
sir i don't have idea about config files please send clearly.i did not yet solve this problem.please send solution for this problem.and i can i use my application in network system.
regards
obalesu
|
|
|
|
|
obalesu wrote: sir i don't have idea about config files please send clearly
Then you should be reading through a beginners book on the .NET Framework. It will explain much more clearly that I could do in the space of a forum post.
obalesu wrote: please send solution for this problem.and i can i use my application in network system.
I can only send suggestions for such a problem. It is up to you to find the solution. I am not paid to do your work. You are employed as a software developer, I would have said it was a prerequisit to know the basics around the technology in which you are developing. So, I repeat my advise to read a beginners book on the subject.
I also don't know anything about your application. To suggest that I could send you some random piece of code that happens to work with your existing system betrays the depth of your lack of knowledge.
Once you have read that beginners book you might be able to solve your problem yourself, or if not, you will have a better understanding of what the problem actually is.
|
|
|
|
|
Hey,
Does anyone know of any best practices winforms projects in C#? As far as i'm aware all of the microsoft ones (pet shop etc) are ASP.NET? A couple of years ago I searched the web for this and the best I could do was the Tracker project, but it was in VB.
Cheers,
Simon.
|
|
|
|
|
SimonH76 wrote: Does anyone know of any best practices winforms projects in C#?
Best Practices are a fundamental thing. They don't change whether is is ASP.NET or WinForms or a Windows Service and so on.
There may be slightly different patterns for applying those best practices but thats it.
|
|
|
|
|
|
|
|
hi to all,
i m using the sdk editor for Windows CE 6.0 platform
i want to change the settings of default keys like for menu if i access the
popup item of menu using the up down keys and Enter key to select that item.
Instead of these keys i want to use char keys like 'P'key for 'Enter' Key
i hope i'll get the soln
thnx in advance
Pankaj
|
|
|
|
|
I’m trying to emulate the look and feel of something like MS Office Accounting, with a common form layout of two lists of label-control pairs, one at the top left of the form, and the other at the top right. Below these is normally a grid, or other controls that span the whole width of the form, e.g.
-|-
-|-
_|_
___
Now it seems to me that the TableLayoutPanel should be the basis of this, allowing the two top sections to dynamically size as the form sizes horizontally. However, I don’t know whether to use four columns, for left label-control and right label-control, and one row for each two label-control pairs, or to use two columns, and a separate container in each column for a vertical list of label-control pairs.
I’ve never used these layout controls before so any advice will be much appreciated.
|
|
|
|
|
Brady Kelly wrote: I’m trying to emulate the look and feel of something like MS Office Accounting
I've never seen it. A screenshot posted to ImageShack might help.
|
|
|
|
|
I have a VB.NET application that runs perfectly on my development machine but when deployed on the customer's machine runs horibly. Both my development machine and the customer machine are alike in that they have both a core2 duo and 2 gigs of ram. The appplication uses SQL Server Express as the data backend. Any time the application performs a function the program hangs before finally completing. "Program Not Responding" is displayed in the title bar during the time the program hangs. I observed the machine resources during this time and there are plenty of resources available. Has anyone run into a simular situation and if so what is the resolution to this problem.
|
|
|
|
|
Run it in debug mode to find out exactly where it is hanging
led mike
|
|
|
|
|
It runs perfecly on my machine. I can't debug it on the customer's machine and there are no errors and it hangs on everything the customer does.
|
|
|
|
|
nathan22405 wrote: I can't debug it on the customer's machine
Are you sure?[^]
nathan22405 wrote: Both my development machine and the customer machine are alike in that they have both a core2 duo and 2 gigs of ram.
It must be something that is different then. So you ruled out processor types and amount of physical ram as the problem. Good start.
led mike
|
|
|
|
|
I hangs on anything that requires access to the database. It's a bit unpredictable though, I can open lets say the inventory screen and it hangs while opening. Once it finally opens I'll close it right away and then reopen it The next time it opens right away and it will for the next 10 or 15 times back to back and then it goes back to hanging again. It's like windows of time will open up and it will work fine and then it goes back to hanging again. I'm thinking it has something to do with the SQL Express and the way I'm using it. Creating connections ect. On my development machine I connect to SQL 2005 Server and not to SQL Express and I never have problems like this.
|
|
|
|
|
nathan22405 wrote: I'm thinking it has something to do with the SQL Express and the way I'm using it. Creating connections ect. On my development machine I connect to SQL 2005 Server
Possible that SQL Server Connections are being pooled by DTS on your machine while the SQL Express version is not. Depending on how you developed your code you may be creating a new connection in many cases.
led mike
|
|
|
|
|
That's what it was. I created a global variable for the connection object. I opened the connection once on the start of the program and ran all commands through it. The Problem went away. THANKS!
|
|
|
|
|
nathan22405 wrote: The Problem went away.
Yes but by using a global variable you may very well have created new problem(s) that you may have to deal with in the future. You might want to study some topics like:
Object Oriented Programming specifically Principles of Object Oriented Programming
Software Design Patterns
Software Development Best Practices and Principles
there are certainly more but that would be a good start
led mike
|
|
|
|
|
That's a HUGE bad practice. In an SQL Servce environment, you've just grabbed a very expensive connection license and are holding it indefinitely. That connection won't be doing anything for about 95% of the lifetime of your app. Does that sound like a good use for a license that costs $$$??
You also didn't solve the problem. You merely got around it by opening the connection once, which will probably have that delay.
What does the connection string look like?? How are you opening the connection when you want to make a query?? How are you USING the connection?? Is it being closed properly when you're done with it??
|
|
|
|
|
Let me clarify this a little bit. We are using SQL 2005 Express. No licenses needed here. Actually what I'm doing in our application is we have a wrapper class that encapsulates all the data access functionality throughout the program. (Execute, ExecuteScalar, ExecuteNonQuery, ...) Additionally we have functions that return datasets and update datasets) Our program can run on a local database or through web services to our hosted databases. I have a global variable (g_Data) that is an instance of our wrapper class. When this class is initialized a connection to the database is made and when the class is disposed the connection is closed. What I have found when using the SQL Express is that when opening connections, running a command, then closing right away a bottleneck occurs when several calls are made back to back to the database because SQL Express does not handle multiple connections at a time. It hangs and waits for a connection to close before continuing. I forgot to mention our program is multithreaded. It has a few background threads that run and perform various maintenance routines. These maintenance routines require data access so if one of the threads has a hold of a connection then the user will experience a wait and often times will get a "program not responding" message in the title bar. When I changed the wrapper class so that only one connection was made upon initialization and all sub sequential commands run through that connection. The problem went away.
|
|
|
|