|
Christian Graus wrote: Why do you need to use the same method when reading from completely different file types ?
Why not? I assume it is some kind of csv file and OleDb can handle all of them in a very similar way. If I remember correctly there is even one example for this somewhere on MSDN.
|
|
|
|
|
Try putting [] around the filename when building your queries.
|
|
|
|
|
hi friends,
Am using [ ] for retreiving file...
The error message is that "Microsoft jet engine could not find the file named test.test.txt.Check whether the spell is correct or not"..Like this...
Thanx
|
|
|
|
|
Standard question #2:
What error message do you get?
---
b { font-weight: normal; }
|
|
|
|
|
hi,thanks for your reply message,
but,
i know i can have an array of form in MDI,
and access to activechild by this.activechild,
now i want to access to activeownedform in OWNER,OWNED FORMS,
and i can arrange my childs in MDI by MDILAYOUT,
how i can arrange my OWNEDFORMS?
so thanks.
have fun.
parastoo
|
|
|
|
|
|
I need a suggestion on opening SQL Connection
Is it better for me to open and close the connection on each form that accces the data or i create i static connection that last thourgh to application run time, then close it..
I got a few feedback saying..
some say if i open and close connection each it may effect the performance and some say that if i open and static connection it will cause memory problem..
for ur info currently i doing with 1 static connection..
please give me an explanation on this issue
thanks
|
|
|
|
|
Open and close the connection, .NET maintains it's own connection pool.
Christian Graus - Microsoft MVP - C++
|
|
|
|
|
I was just boning up on the subject last night, and most DBMSs (if not the .NET itself) maintain a connection pool. This way, it can create how ever many connections it will dole out ahead of time, and assign them as needed, instead of performing the resource consuming actions to create them on the fly. Think of it like an old fashioned hotel switchboard operator's console.. they've got a certain number of outside connections all ready to go, but nothing directly connected to the rooms... When you call the operator, they just plug you in when you request an outside line. This is just the reason you "don't" want to use a static connection. Too many applications holding the line when they don't need it could lock up your DBMS for those that do.
Flicktom
|
|
|
|
|
|
Hi All,
I'm trying to do some simple drawing on a tabpage and I want to do it without using the OnPaint event. What I'm doing is using CreateGraphics to get a Graphics object then I'm calling Graphics.DrawLine to try and draw a simple line on the tabpage, but I can't get it to draw anything. After drawing I'm calling Invalidate and Refresh (I also tried each by itself), but I can't get anything to draw on the tabpage.
Any help on this subject (except telling me to use the OnPaint handler) would be very appreciated.
Thanks.
- Aaron
-- modified at 20:27 Sunday 11th December, 2005
|
|
|
|
|
monrobot13 wrote: I want to do it without using the OnPaint event.
Why ? OnPaint is called by Windows when your form needs drawing. Doing it anywhere else is simply a terrible idea.
monrobot13 wrote: After drawing I'm calling Invalidate
Which calls OnPaint and draws over anything you may have drawn outside of it.
monrobot13 wrote: Any help on this subject (except telling me to use the OnPaint handler) would be very appreciated.
Sorry, I try not to give bad advice
Christian Graus - Microsoft MVP - C++
|
|
|
|
|
[EDIT]I'm just come up on a much bigger problem, that I'm not sure how I missed and maybe you could help me with it. It appears that the UserControl isn't being added to the TabControl. Here's my code for that, which I assume will fix my other problem since I'll now be able to actually see the control. PdsContainer is the TabControl and PdsPage is my UserControl
PdsPage testPage = new PdsPage (DateTime.Now);
PdsContainer.TabPages.Add ("Page1", testPage.Title);
PdsContainer.TabPages[0].Controls.Add (testPage);
Alright. I threw my bad idea out the window, took your good advice and implemented my drawing in the OnPaint handler, but I'm still not getting anything to draw on the window. Here's the code so maybe you could point out what I'm doing wrong.
Pen greenPen = new Pen (Color.GreenYellow, 5);
Point point1 = new Point (16, 129);
Point point2 = new Point (333, 129);
e.Graphics.DrawLine (greenPen, point1, point2);
Refresh (); I tried it with and without that Refresh cause I wasn't sure if I needed it. This code is in the OnPaint handler of a UserControl that is added to a TabControl at runtime in case that helps.
Thanks for the help.
- Aaron
-- modified at 21:04 Sunday 11th December, 2005
|
|
|
|
|
You don't need the Refresh.
You should put the pen in a using statement so it gets cleaned up, this code is leaking resources.
using (Pen greenPen = new Pen....)
{
// rest of the code in here
}
If you wanted a pen 1 pixel wide, Pens.GreenYellow is a better choice again ( although not in this case ).
Have you put a breakpoint in this code to make sure it's called, and checked that your control is 130 pixels wide on the form ? Because I don't see why this shouldn't work.
Christian Graus - Microsoft MVP - C++
|
|
|
|
|
I actually just edited my last post, which may explain why it's not working. The UserControl isn't being added to the TabControl. If possible could you take a look at my previous post which contains the code I'm using to add the UserControl to the TabControl
Thanks so much for the help.
- Aaron
|
|
|
|
|
Have you checked the location, size, name and visible properties of this control ? Perhaps they need to be set in order for this control to appear on the form ? i.e. perhaps it's there but not visible, or not in the visible area.
Christian Graus - Microsoft MVP - C++
|
|
|
|
|
I have testPage.Anchor = (AnchorStyles.Left | AnchorStyles.Top); and testPage.Visible = true; properties set, but it's still not showing anything on the TabPage.
Any ideas?
Thanks.
- Aaron
|
|
|
|
|
Not off the top of my head. Have you checked that the control is in the controls collection, and what it's properties are ? What if you add the control to the tab page manually, or add it to another form ?
Christian Graus - Microsoft MVP - C++
|
|
|
|
|
I just did a test to see if the control was being added to the TabPage controls collection, but it doesn't appear as though it's being added because the returned controls collection is empty. Here's all the code I'm using (it's in the OnLoad event of my Form, I don't know if that makes a difference)
private void PdsPad_Load (object sender, EventArgs e)
{
PdsPage testPage = new PdsPage (DateTime.Now);
testPage.Anchor = (AnchorStyles.Left | AnchorStyles.Top);
testPage.Visible = true;
PdsContainer.TabPages.Add ("Page1", testPage.Title);
PdsContainer.TabPages[0].Controls.Add (testPage);
Control[] ctrls = PdsContainer.TabPages[0].Controls.Find ("PdsPage", true);
foreach (Control ctrl in ctrls)
{
MessageBox.Show (ctrl.ToString ());
}
Form testForm = new Form ();
testForm.Controls.Add (testPage);
testForm.Show ();
} It's not being added to the testForm either. Do you see anything that's amiss?
Thanks for taking the time to help me on this.
- Aaron
|
|
|
|
|
monrobot13 wrote: Control[] ctrls = PdsContainer.TabPages[0].Controls.Find ("PdsPage", true);
What if you drop the 'find' ? I reckon this won't work because the name of your control isn't set.
Christian Graus - Microsoft MVP - C++
|
|
|
|
|
Christian Graus wrote: What if you drop the 'find' ?
That worked and the MessageBox now displays PdsPad.PdsPage so it's getting added to the TabPage's control collection. I also thought the problem might be that I was declaring the PdsPage inside the OnLoad handler so when it returned it was going out of scope, but I moved it into the class as a member variable and it still doesn't show anything. Any ideas?
I appreciate all this help you're giving me.
- Aaron
-- modified at 21:45 Sunday 11th December, 2005
|
|
|
|
|
You don't need the member variable, it's kept in scope because it's part of a collection that is in scope.
Once you can see it in the collection, check it's position and it's size ( and double check that it's still visible ). If that doesn't help, I'm not sure.
Christian Graus - Microsoft MVP - C++
|
|
|
|
|
First, thanks very much for all your help on the issue.
Second, I finally figured out the problem and it's basically that I'm an idiot. I added a couple of extra constructors to the UserControl, but in my infinite stupidity forgot to add the InitializeComponent method to them so none of the controls were actually being created and initialized.
Again, thanks for all your help, if I hadn't been able to confirm (through your help) that the control was actually being added to the TabPage, I would have taken a much longer time to go back and check the UserControl code instead of the code I was using to add it.
Thanks muchly.
- Aaron
|
|
|
|
|
No worries, glad to help.
Christian Graus - Microsoft MVP - C++
|
|
|
|
|
Hi..
Can CE.Net 4.2 support compact framework 2.0
Can I use Visual Studio 2005 C# to develop and windows CE 4.2 Application..
Because the pda that the customer using is installed with Win CE 4.2
I Want to do and small application where they can keyin some info and later upload to ftp serrer from the PDA using dial up modem in PDA
what is the best solution for me
thanks.
|
|
|
|