|
Hello everyone, If you have time, I need some suggestions.
I am making a mileage calculator, it is a project I thought up for me to gain some c# coding skills. Anyway, my dilemma is as follows.
I have a form with 6 combo boxes, one is a "START" and the other 5 are optional "ENDING" routes. Basically, someone can select "Indiana" on the first combo box and select "Akron" on one of the others, hit the calculate button and it will tell the mileage.
I have a DataTable set up with 3 columns "FROM|DEST|DIST" so it would be like
"Indiana" "Akron" 120
"Indiana" "Kalamazoo" 211
"Kalamazoo" "Phoenix" 1100
My problem is when i populate my first combo box with the "From" category, I get tons of duplicates, as there are many names in the from category that are the same. How Im adding data is below (Yes its being hardcoded, I dont know enough about databases to set one up yet)
xDt_List = new DataTable();<br />
<br />
xDt_List.Columns.Add("Start", typeof(string));<br />
xDt_List.Columns.Add("Dest", typeof(string));<br />
xDt_List.Columns.Add("Dist", typeof(short));<br />
<br />
DataRow xDr_Row = xDt_List.NewRow();<br />
<br />
xDr_Row["Start"] = "Indianapolis";<br />
xDr_Row["Dest"] = "Kalamazoo";<br />
xDr_Row["Dist"] = 211;<br />
xDt_List.Rows.Add(xDr_Row);<br />
<br />
xDr_Row = xDt_List.NewRow();
and so on and so forth...
Thank you for *any* suggestions on how I could make this a little more effecient ect.
modified on Tuesday, January 15, 2008 11:16:32 AM
|
|
|
|
|
DataTable.DefaultView.RowFilter = "Start DISTINCT";
ComboBox.DataSource = DataTable.DefaultView;
only two letters away from being an asset
|
|
|
|
|
I need to write an application in c# 2003 that is a window service that hosts a remoting object of type singelton.
Is there anyway to notify the service (the host) when a message from the client arrives to the remote object
sample code will be greate help
than
|
|
|
|
|
poqeqw wrote: I need to write an application in c# 2003 that is a window service that hosts a remoting object of type singelton.
They hide that information in the documntation[^]
|
|
|
|
|
How to change the icon of custome Components.
I am able to change the icon in toolbox but while draggin the control
into form default icon is coming !
Any idea ??
Thanks in advance
|
|
|
|
|
Can you explain what you mean by "while draggin the control into form default icon is coming !"
I don't know what that means.
|
|
|
|
|
if you think about ColorDialog Box , it is a custom control, now in tool box it has a icon and while dragging that from tool box the icon are same , but i have build a custome componets and in toolbox i am getting icon what ever i gave but while draggin default (circle) icon is coming !!!
|
|
|
|
|
Hi. Im sort of a newbie in C# but i have a task for my graduation subject to create an application - a game or some sort of a quiz. Anyway, the application itself is not a problem. The problem occurs at the end of the game, because i had an idea that the player will get a diploma at the end of the game.
The diploma should look like this: The background is an old scipt (the game occurs around the 16th century) and on this script is some written text. There should also be an option to print out the players name.
So, please explain, if you can, if it's possible to edit an .doc file with some objects already present in the file (text, background) and add some text (the players name) in the middle of the page.
I know that printing some text, directly from a C# application is possible, but a file? and before printing, editing this file?
Is it complicated? If you could please add some code at your reply.
Thanks in advance,
Max
ps: sorry for my bad english.
Força Barça!
|
|
|
|
|
I think the easiest way to do this with Word would be to use the VSTO[^].
However, a better approach might be to investigate the PrintDocument[^] and related classes[^] so you can roll your own solution.
|
|
|
|
|
Thank you for your fast answer. I will check those things out... but can anyone gime me an particular example? something small, just to see how it would look like. To read the file, edit the file and print it out.
Anyway, i will take a look myself at those links and try to find my own solution, but i doubt that it will come out soon my deadline is in a month.
Bye,
Max
Força Barça!
|
|
|
|
|
Hi
I'm looking for a calendar that on which to add holidays etc onto, I've seen the month calendar and this is just what i am after with the exception that I would prefer to see a whole 12 months and not just 1 month at a time. Is there any way of doing this??
Thanks
Scott
I'm trying.......very trying
|
|
|
|
|
The normal way to do this (a la Outlook) is to display 12 of the calendars.
|
|
|
|
|
Thanks Pete,
That was my thinking, though with the standard monthcalendar it can be expanded to show the 12 months and i was just wondering if this could be applied with the added customisation
|
|
|
|
|
Hi i have given an URL say http://www.mysite.com/x.pdf
now i have to download this file [x.pdf] on the server through C# code.
can any one help me in this regards?
|
|
|
|
|
Open a webrequest and download it.
WebRequest myWebRequest= WebRequest.Create("http://www.mysite.com/x.pdf");<br />
Stream newStream = myWebRequest.GetRequestStream();
only two letters away from being an asset
|
|
|
|
|
Hi guys,
this is the situation:
-i use a OpenFileDialog to get .doc files
-the file wil be saved into sql server table
-with a another button i can load that file from sql and open it with MS Word.
-the file wil also be saved in a directory on the disk. where to save? the path wil be read from config.xml that is located on the 'release' folder of the application(by loading of the form).
the problem:
- when u load the form for the first time, it works fine.
- bud the second time i dont know why bud the app trys to load the config.xml from the folder where i got my .doc file.
for example suppose that the last time i got a .doc from My Documents folder then i get the error:
Can't find C:\Documents and Settings\Me\My Documents\Config.xml
if from C:\ :
Can't find C:\Config.xml
bud the config.xml is located on release folder and this is the code to load the xml:
XmlDocument configfile = new XmlDocument();<br />
configfile.Load("Config.xml");
anyone a idea how to solve this?
|
|
|
|
|
Hi, if you use relative file paths, you rely on the value of the "current directory",
but this one may change, e.g. when switching directories in an Open/SaveFileDialog
(unless some properties prevent that).
It is best to use absolute paths to access application files such as config.
You can calculate the absolute path starting from system information such as the
current directory at app start, or Application.ExecutablePath
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.
|
|
|
|
|
Hi Luc Pattyn,
Thanx for your reply, it realy helped
|
|
|
|
|
Graag gedaan.
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.
|
|
|
|
|
Hoi,
Nog es bedankt en ik heb jou een mailtje gestuurd. Zou je die even lezen aub!?
Groetjes.
|
|
|
|
|
Djavid j wrote: Hoi,
Nog es bedankt en ik heb jou een mailtje gestuurd. Zou je die even lezen aub!?
I'm sorry, but you seem to have got your keyboard a bit jammed up here. Perhaps you could keep this board operating in it's default English only setting. Anything else causes the hamsters to go into attack mode.
|
|
|
|
|
That is the whole idea, gremlins make the site run faster.
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.
|
|
|
|
|
Luc Pattyn wrote: gremlins make the site run faster.
Screaming in terror I assume.
|
|
|
|
|
I presume your config file is in the same directory as the executable? Do you tell it this, or does it just "find" the file the first time?
The issue here is that you're relying on the config being in the applications "current" directory (which it is on startup, since the current directory is defaulted to the exe's folder)
When you use OpenFileDialog it changes the current directory to the location of the file you browsed to, meaning the config can't be found any more.
My suggestion would be to use System.IO.GetCurrentDirectory[^] on startup, and use this when loading the config.
e.g. something like:
m_ApplicationDirectory = System.IO.GetCurrentDirectory();
m_Configfilename = m_ApplicationDirectory + "Config.xml";
...
XmlDocument configfile = new XmlDocument();
configfile.Load( m_Configfilename );
|
|
|
|
|
Hi i'm new in remoting and since that have any common question about
1) How i can understand in server part what some client is expired on client part(detroyed by gc)
2) How my client (on client part) can understand what server is no longer exists (i.e. remote instance of this client to what one delegate ones calls no longer exists)???
TANHK A LOT
|
|
|
|