|
Guess what. It worked!
There are still a couple more things to work upon, but that was really starting to bug me! The way I saw it, I thought it had to do with timeouts or something, since the data was partially read, now I realize it's all in that class' miserable coding lol.
Thank you so much Luc! You're a life-saver
P.S. I wanted to add that post as a Good Answer but it's only appearing on the first post you made... Sorry about that haha.
|
|
|
|
|
You're welcome.
Luc Pattyn [Forum Guidelines] [My Articles]
The quality and detail of your question reflects on the effectiveness of the help you are likely to get.
Show formatted code inside PRE tags, and give clear symptoms when describing a problem.
|
|
|
|
|
Hey,
When I programed a new software in C# with Windows Form I got an "unsolved" problem that I hope you can help me with:
I written a form, when I resizing it the form get bigger but the controls still the same.
I wanted to know if there is a .NET built in command that can solve that probem? or i have to use the "Resize" event and set it myself?.
And if yes - when i get the Resize event, can i know what is the last size before the resize and now?
(like when i get the EventArgs e can i do someting like e.LastX or e.LastY)?
Thanks you very moch!, Yahav.
Gindi Bar Yahav - Web & Software developer.
|
|
|
|
|
You need to use proper anchoring and docking for the controls in the form.
It's not necessary to be so stupid, either, but people manage it. - Christian Graus, 2009 AD
|
|
|
|
|
You can use Control's .Anchor to dock the control according to the container size, though controlling how the controls resize is limited.
Or you can put the controls in a TableLayoutPanel or FlowLayoutPanel, you will have more control on how the controls react to resizing.
|
|
|
|
|
So there is no other way to "say" to C# - "I want that control (for example button) to resize automatic"?
Gindi Bar Yahav - Web & Software developer.
|
|
|
|
|
This is the way to that. Or handle the form's resize event and position and resize the controls accordingly.
It's not necessary to be so stupid, either, but people manage it. - Christian Graus, 2009 AD
|
|
|
|
|
That's what the Anchor or Dock properties for, for simple panel, tabpanel, or simple arrangement of buttons.
For more complex arrangement, you should use tablelayoutpanel
|
|
|
|
|
As the others have already answered. The controls aren't set to grow automatically... If that helps solving the problem, you can set the border to Fixed (so that it is not resized), however that doesn't solve the problem.
To actually solve the problem you can either handle the Resize event and grow the controls accordingly, but what would seem better (and easier) would be to click the controls in Designer mode and setting their Anchor to the most according manner. I have had no problems with this method so far.
With regards to the last part of your question, I believe that you can get to know the previous size by checking on the ResizeBegin event, and comparing with the ResizeEnd or Resize event. There might be easier solutions, it's just one that came to my mind at the moment.
Regards,
Trapper
|
|
|
|
|
Can I add more columns to resource file. Now it has only 3 columns and can i use it as a table. If it is possible please let me know how to do it.
Dushan Perera
|
|
|
|
|
Sounds like you need to add a database of some sort. No, you cannot do that.
Christian Graus
Driven to the arms of OSX by Vista.
Read my blog to find out how I've worked around bugs in Microsoft tools and frameworks.
|
|
|
|
|
Hi all,
using SHDocVw.InternetExplorer,(DOM)
How to identify the link, that is clicked in a page.
For an example if i click "Message Boards" in this page, then i have to capture the string of that link as "Message Boards"
Can someone help me.
thanks in advance
|
|
|
|
|
Hello,
I am a beginner to ASP.NET. I need some directions for this task.
Information about task:
Phase 1 : Assume Server whose health to monitor is GEMINI.
Create two unattended (non UI) Windows Services (or Windows exe) written in C#.
Every specific “duration” the windows services will be invoked.Use app.config file to store this duration value.
Should check the server (GEMINI) if it is up or down.
Check the following various applications under following broad classifications in the server.
Server
IIS
SQL Server
Windows Service ( control panel --> under services u see services running)
Windows Exe
Web Service
If the application is down and the server is down it has to log data into the sql server database.
Thanks in advance!
Ramito
|
|
|
|
|
ramindya wrote: I am a beginner to ASP.NET.
Apparently sufficiently so that you could not find the ASP.NET forum.
ramindya wrote: Assume Server whose health to monitor is GEMINI.
Create two unattended (non UI) Windows Services (or Windows exe) written in C#.
Every specific “duration” the windows services will be invoked.Use app.config file to store this duration value.
Should check the server (GEMINI) if it is up or down.
Check the following various applications under following broad classifications in the server.
Server
IIS
SQL Server
Windows Service ( control panel --> under services u see services running)
Windows Exe
Web Service
If the application is down and the server is down it has to log data into the sql server database.
This is NOT a beginner task. It's also not an ASP.NET task ( so you are in fact in the right forum ).
There's two possibilities here that I can see.
1 - you are doing a course. If so, this course is INSANE, to give you a task like this, when you're a 'beginner', to the point that you can't even tell if this is an ASP.NET task or not. Quit the course.
2 - you've been given this task as part of your job. In which case, you and the people you work for, are immoral, dishonest thieves. If you don't know how to do it, don't accept the work.
Christian Graus
Driven to the arms of OSX by Vista.
Read my blog to find out how I've worked around bugs in Microsoft tools and frameworks.
|
|
|
|
|
Hi,
I have a windows form app which downloads attachment in outlook emails on a button click event and shows the contents to the users. The attachment which I am reading is an Excel file.
Recently I came across the background worker class which operates on a different thread other than the main process thread. I would like to know how to automate the button click event into a new thread...so that the user doesnt need to click on it to download attachments everytime and get displayed data.I want this to happen automatically. (by removing the button click event)
I want the app to check for new emails every 5 minutes(maybe by using System.timer .. etc) and download and process any email with excel attachment and display to the user. without the user getting interrupted while the application is downloading and processing the excel. How do i go about doing this using the background worker?
Suggestions appreciated...
Thanks
|
|
|
|
|
Hi,
you could organize it like a simple loop (pseudo-code):
for(;;) {
...
Thread.Sleep(5*60*1000);
}
All this could reside inside the DoWork handler of a BGW.
Alternatively, you could just use a System.Timers.Timer, that would cause your code (without loop and sleep!) to run periodically, with the risk of one iteration taking too long and being overrun by the next.
For both of these, you are not allowed to directly touch any GUI Controls, you need Control.Invoke; see here[^] for details.
Luc Pattyn [Forum Guidelines] [My Articles]
The quality and detail of your question reflects on the effectiveness of the help you are likely to get.
Show formatted code inside PRE tags, and give clear symptoms when describing a problem.
|
|
|
|
|
Hi thanks for ur answer,
I would like to call the Thread.Sleep(5*60*1000) after the execution of runWorkerCompleted. This is because in the DoWork it is downloading the attachments ,,,but waiting for the specified time before displaying data.
|
|
|
|
|
Hi,
the last thing a BGW does is make sure RunWorkerCompleted gets called; this event runs on the GUI thread, you are not allowed to do any Thread.Sleep in there as that would block the entire GUI. However you are allowed to start a (5-minute) timer there.
Luc Pattyn [Forum Guidelines] [My Articles]
The quality and detail of your question reflects on the effectiveness of the help you are likely to get.
Show formatted code inside PRE tags, and give clear symptoms when describing a problem.
modified on Thursday, August 20, 2009 9:33 PM
|
|
|
|
|
For something like that I have used a System.Timers.Timer, but I've also left the button in case the user gets impatient.
(I also allow the user to specify the period or disable the periodic check.)
|
|
|
|
|
To add to the excellent answers you already have...
If you have code inside the button click that you don't want to duplicate or refactor into a separate method, Button has a PerformClick method that you could call from the timer so there would be no difference at all between the user clicking it and your code 'clicking' it.
DaveBTW, in software, hope and pray is not a viable strategy. (Luc Pattyn) Visual Basic is not used by normal people so we're not covering it here. (Uncyclopedia) Why are you using VB6? Do you hate yourself? (Christian Graus)
|
|
|
|
|
Thanks ppl, for all your answers. Appreciate it
|
|
|
|
|
yeah that could be done, but what if the user is currently using the system and the the perform click event occurs after the timer, it would interrupt his work. !!
|
|
|
|
|
It doesn't take control of the mouse and click the button! It just calls the Button's protected OnClick method internally.
DaveBTW, in software, hope and pray is not a viable strategy. (Luc Pattyn) Visual Basic is not used by normal people so we're not covering it here. (Uncyclopedia) Why are you using VB6? Do you hate yourself? (Christian Graus)
|
|
|
|
|
Hello Everyone-
I'm learning C#. I am working with adding some images into an application now, for example, on a button. When I select Image, I am presented with a couple of options. I can import an image under "Local Resource" or I can import the image under "Project Resource File". I am wondering what the difference is between the two, and which one I should be using?
It appears that when I select an image to be imported into the project resource file, the next time I compile it, the executable is bigger, so I'm assuming that the images are compiled into the exe? (Ie, so I do not have to distribute individual image files with my application??)
Thank you!
|
|
|
|
|
Yes, the image is compiled into the .exe (in both cases).
A "Project Resource" is shared between all forms in the project, so you can reuse the image in multiple forms.
A "Local Resource" is available only in that single form. You could create multiple local resources with the same image, but that would embed multiple copies of the image in your .exe.
|
|
|
|