|
You can use the PrinterSettings[^] property to check the printer name that the user selected.
PrintDialog pd = new PrintDialog();
if (pd.ShowDialog() == DialogResult.OK)
{
if (pd.PrinterSettings.PrinterName == @"\\unc-path\myPrinter\")
{
pd.PrinterSettings.PrinterName == @"\\new-unc-path\newPrinter";
}
}
Don't be overcome by evil, but overcome evil with good
|
|
|
|
|
I am new in c#.I am facing a problem to connect a page with another page in same window.how can I solve this problem?
|
|
|
|
|
are you doing a WinForms project?
if you are i think you want MDI windows....
to do that set the window you want to contain all the other windows MdiContainer property to true. Then When you create the child form set its MdiParent property to the instance of the parent.
buttonOneClick(object sender. EventArgs e)
{
MyChildForm myChildForm = new MyChildForm();
myChildForm.MdiParent = this;
myChildForm.Show();
}
Harvey Saayman - South Africa
Junior Developer
.Net, C#, SQL
you.suck = (you.passion != Programming)
|
|
|
|
|
|
yes use MDI like said before. Download some samples/articles here in codeproject and give it a try.
You should try also design usercontrols, and place then inside your form.
Preventing/Instead of creating many forms, you can create many usercontrols and display/load then in the same form.
I think you are going to use this more often.
GoodLuck
|
|
|
|
|
I have a datetimepicker in my device application(Compact framework). I have put a textbox.I am not able to show today's date in textbox by selecting today's date in datetimepicker. I used the event selectedvaluechanged of datetimepicker. I need to show any other date and then only i am able to show today's date
|
|
|
|
|
Either select a different value for it's initial value or after setting the date call the ValueChanged method manually.
dateTimePicker1_ValueChanged(this, EventArgs.Empty);
DaveBTW, in software, hope and pray is not a viable strategy. (Luc Pattyn)
|
|
|
|
|
Hi,
Why do I get these funny little squares when I read Arabic data from my database??
I'm using Oracle 10g and it's working quite fine with any language "I can save it and view it correctly using Oracle sql*plus" but it gets encrypted on my window form...
Please help.
All generalizations are wrong, including this one!
(\ /)
(O.o)
(><)
|
|
|
|
|
Maybe the control which shows your data has a font selected which does not contain Arabic characters. Often the default font is MS Sans Serif, and this lacks many characters. If you change the font to Arial, Tahoma, Courier New or something you should see your data.
|
|
|
|
|
Thanks Frank, but no,
I actually tried many fonts including Tahoma and Airal and even Arabic fonts and set the script to Arabic for this control "it's a tree view".. I thought it was as easy as this but no..
Thanks anyways Frank!
All generalizations are wrong, including this one!
(\ /)
(O.o)
(><)
|
|
|
|
|
If it's not the font, it must be lost somewhere else. Do you fill your tree view with self made code or do you use some sort of data binding? And do you read from the database with a plain data reader or do you use a data adapter plus dataset? Does your connection string contain anything that might enforce a certain codepage? In my experience (though not with Oracle but only with MS SQLServer) using the Visual Studio designer to define connections, datasets and things often leads to strange results
Maybe you can debug or write to the console (or a log file) what characters you actually get in which layer. Or just set up a tiny test application which just connects, reads a string from the table and writes it to the console.
|
|
|
|
|
Hey Frank,
Thank you for your replay mate!
I'm glad to tell you that my problem was solved simply by deleting the database and re-install it!!
Very funny eh?? I never thought the problem could reside in the database in this case but it did!
Thank you for your time Frank!
Frank Horn wrote: using the Visual Studio designer to define connections, datasets and things often leads to strange results
True, and there's no way I'd let the designer interfere in database business!
All generalizations are wrong, including this one!
(\ /)
(O.o)
(><)
|
|
|
|
|
Hi, I would like to access a directory on a server drive which is D:\myfolder
Is this the correct syntax?
@"\\" + servername + @"\" + @"D:\myfolder"
Thank you.
|
|
|
|
|
punkymt1 wrote: @"\\" + servername + @"\" + @"D:\myfolder"
Yes, correct
Did you faced troubles using it ?
foreach(Minute m in MyLife)
myExperience++;
|
|
|
|
|
Cheers thanks. I am going to try it on another pc since mine does not have access to this server and I would like to move the exe only.
|
|
|
|
|
Thats only correct if the D drive is shared as "D:"... which isnt the case if you just accept the default which is driveLabel(Drive Letter)
if its shared as "Blah blah" your path should read "\\serverName\blah blah\myFolder"
[edit]
you cant share the drive as "D:", it doesn't allow the semicolon. Tested on XP
[/edit]
Harvey Saayman - South Africa
Junior Developer
.Net, C#, SQL
you.suck = (you.passion != Programming)
|
|
|
|
|
I'm using
@"\\" + servername + @"\" + @"D$\myfolder"
or if you have a share directory, for example PUBLIC, then use:
@"\\" + servername + @"\" + @"PUBLIC"
|
|
|
|
|
I needed the "$". What is it called?
|
|
|
|
|
I would also look into
Path.PathSeparator
Path.VolumeSeparatorChar
Path.Combine
and really just the System.IO.Path class in general
hth
modified on Monday, July 28, 2008 7:10 AM
|
|
|
|
|
Thanks for the help
|
|
|
|
|
I created an application that connects to MS Access Database
I compiled, built, and ran the application, and everything went well
Then I copied the *.exe file to another folder and other computers
I ran it many times with no problems
But, sometimes it does not work and displays the message (Unable to find a version of the runtime to run this application)
And this problem is not solved till I rebuild the source code again
I rebuild and run for 10s of times and the problem appears again
What is the source of such aproblem, and what is the true solution
foreach(Minute m in MyLife)
myExperience++;
modified on Monday, July 28, 2008 4:16 AM
|
|
|
|
|
A couple of suggetions.
Create a set up project or publish your app using click once and install on the other computersrather than just copying the exe.
If you've already made an installer, recompile it first.
If that fails - you may need to reinstall the .NET framework, but if the problem is occuring on more than one computer then it's unlikely to be a framework error.
DaveBTW, in software, hope and pray is not a viable strategy. (Luc Pattyn)
|
|
|
|
|
DaveyM69 wrote: Create a set up project or publish your app using click once and install on the other computersrather than just copying the exe.
you will be surprized when you know that this problem occurs with the executable file even while running from the bin directory itself
another thing I recently noticed, is that th file size changes
when it runs proberly its size is 452 kb
when it fails, its size becomes 484 kb
DaveyM69 wrote: If that fails - you may need to reinstall the .NET framework, but if the problem is occuring on more than one computer then it's unlikely to be a framework error.
yes, the problem occurs in more than machine
I am installing .NET Framework version 1 and 2 together on the same machine
Do you think I need to unistall one of them?
foreach(Minute m in MyLife)
myExperience++;
|
|
|
|
|
Did you check the computer where you're experiencing troubles for malware/viri?
A change of file size for no obvious reason sounds very suspicious.
Not long ago I had a problem at a customer's site. One of our applications wouldn't run correctly on one computer - a keylogger or something like this had messed up the command line switches...
Running a virus scan could be worth a try.
Regards,
mav
--
Black holes are the places where God divided by 0...
|
|
|
|
|
I've heard of problems when running v1 (with a service pack if I remember correctly) and then having v2. I seem to recall some major problems when the OS was Win98.
Unless you have a specific reason for having 1.0 or 1.1 - I'd remove all versions then install 2.0, and if needed 3.0 & 3.5 (and relevant Service Packs).
The file size change is worrying - that shouldn't be happening. Sounds virus like to me too. If that's happening on all the PCs then it may be your exe that's infected if indeed it is a virus.
DaveBTW, in software, hope and pray is not a viable strategy. (Luc Pattyn)
|
|
|
|