|
Hi Friends,
I am having an windows application created using C#. Its having a MDI form and many child forms. What i have to do is when i click a menu from the MDI window i get a form having a datagrid and many other calculations done and at the end of the page i have a print button. I want to print that entire page when i click the print button. I got a code from google but what it does is capture the screen and then prints. since it captures only what we can see in the screen i dont get the rest of the content which is visible only if i scroll down the window. i want the entire page to be printed.
Thank u,
Vips
|
|
|
|
|
If you want to draw your own page, then use this:
private PrintDocument pd = null;
private void Init()
{
this.pd = new PrintDocument();
this.pd.PrintPage += new PrintPageEventHandler(pd_PrintPage);
}
private void Print()
{
this.pd.Print();
}
private void pd_PrintPage(object sender, PrintPageEventArgs e)
{
e.Graphics.DrawString("Hello World", new Font("Times New Roman", 14), Brushes.Black, 650, 130);
e.Graphics.DrawLine(new Pen(Brushes.Black, 1), 10, 155, 800, 155);
...
}
You can use also crystal report. But I don't know how to use it.
|
|
|
|
|
Thank u friend,
Thank u so much for ur fast action.
I dont want to draw a form. I already have a windows form with lot of controls.I just want to print that form. I did that by capturing the window screen as an image and then passed it to printprieview control and from there i printed. but the problem as i told earlier is that when there are controls which are visible only if we scroll down the page that part of the page will not be printed. i want a code that prints the whole form content.
Vipin
|
|
|
|
|
If you want to print the whole page, then you must use Crystal Report to get a nice result.
|
|
|
|
|
Im wanting to develop a tool that can scan numerous subnets within a network and ping each ip address to see if any SNMP devices exist. What is the most efficent method/architecture to go about this in c#?
Thus im mostly interested in the method of calling one ip to the next, SNMP itself isnt an issue here. So what classes etc should I be looking at.
Any help much appreciated
jeff
|
|
|
|
|
mikeyhardingboyo wrote: So what classes etc should I be looking at.
Socket
"Just about every question you've asked over the last 3-4 days has been "urgent". Perhaps a little planning would be helpful?" Colin Angus Mackay in the C# forum
led mike
|
|
|
|
|
Actually the reason for this is:
i want to do printscreens within my application(like after i press a button on my form, this button press will run a method with printscreen function), therefore at first i had
Application.DoEvents();
System.Threading.Thread.Sleep(1000);
but i read up on application.doevents() and there is an issue that it may go into an event twice..
Is there a way to check when the windows form is completely loaded or repainted as i run my application?
Or is there suggestions to let the application wait while continuing to load? cos if using thread.sleep only, the whole application will pause and the form loading will also pause.
Or is there any alternative to application.doevents() ?
Let me clarify that i am not using this in the form_Load but using it in other methods within the form.
i'll appreciate any help. Thanks.
|
|
|
|
|
how can i obtain the state of mouse. for example, mouse clicked on any where, and i realise that this click.
|
|
|
|
|
Please write a useful title.
Catching a mouse click is generally done by catching the Click event of the element you are clicking on.
---
b { font-weight: normal; }
|
|
|
|
|
Hi
I'm looking for a way to place an edit box permantly visible into the system tray or task bar to allow quick entry of data without actually having to open the program.
I could not find any code.
Any hint is appreciated
Eriks
|
|
|
|
|
Hi,
I am running a C# windows application which has a config file pointing to files on the C:\ drive. However, when I run the application it throws a system message similar to this:
"The selected disk drive is not in use. Check to make sure a disk is inserted."
The disk drive in question is the E:\ drive which happens to be the DVD drive on the computer. Nowhere in the application does the code refer to the E:\ drive. So I am confused why this message is appearing. Can anyone help?
Emma
|
|
|
|
|
Hi!
Could it be that some OpenFileDialog or SaveFileDialog is still remembering a path on E:\?
Regards,
mav
--
Black holes are the places where god divided by 0...
|
|
|
|
|
I am using the .Net 2.0 WebBrowser control and even when I set the visible property to false I still hear the "click" start navigation sound you hear when you click on links in internet explorer. I would like to find out a way to somehow disable this because I'm using this control in invisible mode to do some behind the scenes navigation, I dont want me users to hear this sound.
Many thanks to someone who has an idea,
Michael
|
|
|
|
|
You could save/null/restore the "Start Navigation" and "End Navigation" sounds associated with Windows Explorer before/after your navigation.
/ravi
My new year's resolution: 2048 x 1536
Home | Music | Articles | Freeware | Trips
ravib(at)ravib(dot)com
|
|
|
|
|
that's a good idea, i actually thought about it also, but i was trying to avoid affecting the user's computer just for the purposes of my application, it sounds too invasive, thanks for suggesting this.
|
|
|
|
|
Hi
I am looking for an algorithm that translates languages (not programming languages but written languages, eg English -> Dutch)
I know this has been done many times before so I'm not looking to reinevent the wheel. Can anyone help me with this problem?
Thanks
|
|
|
|
|
Ben, as you might expect, natural language translation is pretty non-trivial. But perhaps this[^] little class may help?
/ravi
My new year's resolution: 2048 x 1536
Home | Music | Articles | Freeware | Trips
ravib(at)ravib(dot)com
|
|
|
|
|
I have 2 forms. I am using form1 as my parent and form2 as a child form. I also have a class (clBuffer) name of my class. In my class(clBuffer.cs) i have 4 strings. How do I send value to those strings from parent class, and how do I read them from the child class?
Thanks
|
|
|
|
|
If the strings are static members of the class, you can access them directly using the class name.
If the strings are instance members of the class, you have to create an instance of the class in order for the strings to exist, then you can access the strings using the reference to that instance.
---
b { font-weight: normal; }
|
|
|
|
|
Hi
i have 2 exe file. first is main exe and second is my exe .
i want ..when end user run main exe . my exe first run and calculate some conditions if true then run main exe otherwise do not run main exe .
but how to do that ??
|
|
|
|
|
You can't do that. What you can do is have your main EXE check for some condition that says, "Yes, the other .EXE has run". If not, then it has to launch the other .EXE itself and wait for it to complete its work.
You're only other option is to setup a batch file that runs the .EXE's in order and make sure any shortcuts point at that batch file, not the .EXE files.
Dave Kreskowiak
Microsoft MVP - Visual Basic
|
|
|
|
|
More of a high level question, than a specific C# question. I need to put together an application that sits on top of what I consider to be a very large database. This database mainly consists of the following tables:
Table 1
id (int, primary key, index)
value1 (varchar 50)
value2 (varchar 50)
value3 (varchar 50)
value4 (varchar 50)
value5 (varchar 50)
value6 (varchar 50)
value7 (int)
value8 (int)
value9 (int)
Table 2
id (primary key, index)
table1_id (int, foreign key to table1 id)
value1 (varchar 50)
value2 (varchar 50)
value3 (int)
Currently table1 has around 350 million rows, table 2 has around 900 million rows. So as you can see the volumes of data here are fairly large.
My application needs to be able to search these tables on any of the data columns and display results in a datagrid (or other suitable control), obviously searches could result in large result set. User should also be able to update a single row, or a batch of rows.
The initial version of this application (coded before the database became so huge) just used a simple single line list view and worked perfectly. Now the volume of data are so large I have had to restrict search results to 500 rows, which is annoying end users. So I need to find a viable alternative
So the questions are as follows:
1) Whats the best approach for handling this in a C# based application. After googling for most of today I have come across a number of "solutions" however I do not want to go steaming down the track of one of these to discover that it is slow.
2) Although not specifically C# related, could this table structure be optimised in any way? As an example I am considering normalising the varchar data.
-- modified at 19:37 Wednesday 5th July, 2006
|
|
|
|
|
Hello,
I don't have an answer to your second question right now, but I can make a suggestion for the first question.
My suggestion is to use a grid control which allows you to implement a "virtual grid". Basically, a virtual grid does not store the data in memory for any of the cells in the grid. Instead, when the data for one of the cells needs to be displayed, the control makes a request (some sort of callback function) and retrieves the data that way. This would allow you to store only a small part of the data of your database in memory at a time - namely, just as much data as the user can see at one time. Here is basically how I see it working (I have done a virtual grid pulling from a database before, though my implementation was in C++ and probably not the most efficient one):
1) Application loads and so does the grid.
2) Grid requests data for the first hundred rows.
3) Your app queries your database and gets back a data set with those hundred rows and hands them to the grid view. The SQL pull back is fast, because it is SQL, and displaying the items in the grid is fast, because they are stored in memory.
[now there are only one hundred rows in memory]
4) The user uses the scroll bar to scroll down to the next hundred rows. The first hundred rows are now hidden, the next hundred must be displayed.
5) Grid request data for the second hundred rows.
6) Your app queries your databse and gets back a data set with the second hundred rows and hands them to the grid view. This takes about the same amount of time for the first hundred rows.
[there are only one hundred rows in memory)
And so on: as the user scrolls or searches, you simply pull back the data which needs to be displayed and pass it to the grid.
The great thing about doing it this way is that everything takes roughly the same amount of time and is fairly quick, even if your database grows bigger. Obviously the more rows you wish to display at once, the longer it will take and the memory it will take, but this isn't really an issue, because the number of rows that can fit on the screen is limited.
Now, I haven't built an application that has had to deal with the volume of data which you are working with, but conceptually I think this idea works. Please take this simply a suggestion, and not an expert opinion.
For a C# grid which supports virtual grid, just do a search on this site. One such grid is: SourceGrid[^]. I haven't tried this one yet, but it looks good.
Please let me know if you have any questions about this, and I'll try to answer them.
Sincerely,
Alexander Wiseman
|
|
|
|
|
MrEyes wrote:
2) Although not specifically C# related, could this table structure be optimised in any way? As an example I am considering normalising the varchar data.
Probably yes, but without knowing what "value1", "value2", etc, mean, it will be very hard to suggest anything. A lot of varchar(50) in a SQL Server always smells like someone did not spent too much time designing the database...
You have a lot of varchar fields, which would be easier to search if you use a full text indexing solution, like the one that comes with SQL Server (you didn't mention your specific DBMS).
MrEyes wrote:
The initial version of this application (coded before the database became so huge) just used a simple single line list view and worked perfectly. Now the volume of data are so large I have had to restrict search results to 500 rows, which is annoying end users. So I need to find a viable alternative
You can raise this value a lot (probably easily up to 10,000 or 50,000 rows, but I don't know your hardware) if you use the listview in virtual mode, as you won't need to add items to the listview.
Bear in mind that giving your users 50,000 rows is a pseudo-solution. It's a lot of data to search manually. If you spend 1 second reading or understanding each row, it can take up to 14 hours to read everything.
You'll need to give your users a decent UI, automatically clustering or grouping results, or some way to refine searches.
I don't see dead pixels anymore...
Yes, even I am blogging now!
|
|
|
|
|
Daniel Turini wrote: Probably yes, but without knowing what "value1", "value2", etc, mean, it will be very hard to suggest anything. A lot of varchar(50) in a SQL Server always smells like someone did not spent too much time designing the database...
You have a lot of varchar fields, which would be easier to search if you use a full text indexing solution, like the one that comes with SQL Server (you didn't mention your specific DBMS).
Basically this is an MS SQL database that stores unfiltered incoming SNMP traps from a vary large array of devices (6000+). The table model I have inherited is as follows
[captured_traps]
[id] [int] IDENTITY (1, 1) NOT NULL ,
[snmp_version] [int] NULL
[community_name] [varchar] (255)
[packet_type] [varchar] (50)
[oid] [varchar] (500)
[source_ip] [varchar] (15)
[generic] [int] NULL
[specific] [int] NULL
[time_stamp] [varchar] (15)
[trap_entered] [datetime] NULL
[status] [int] NULL
[captured_varbinds]
[id] [int] IDENTITY (1, 1) NOT NULL
[trap_id] [int] NULL
[varbind_oid] [varchar] (500)
[varbind_text] [varchar (500)
Storing data as string is, I believe unavoidable otherwise it would not be possible to search data. However the design has alot of repeated data in some fields, I believe that normalising the varchars would give a significant performance enhancement. Or as you suggested using text indexing
Daniel Turini wrote: Bear in mind that giving your users 50,000 rows is a pseudo-solution. It's a lot of data to search manually. If you spend 1 second reading or understanding each row, it can take up to 14 hours to read everything.
You'll need to give your users a decent UI, automatically clustering or grouping results, or some way to refine searches.
This is very true, and most searches do not create massive result sets. However the app allows users to search on any field or combination of fields within any date range. More often than not the search is for a specfic oid on a specific day. However the app needs to be able to support a user running a search for a specific oid receive in the last 3 years
|
|
|
|
|