|
Hi i was just wondoring if anyone knows how to create a trafic program with the 3 lights and cars going from left to right, right to left, up down and down up in c#
i did it in java it is easy but how can we do it in c#
thx
/\|-||\/|/\|)
|
|
|
|
|
It also the same. You can take your java source code and a little bit changes then you can compile it using C#. The language is almost the same.
|
|
|
|
|
stancrm wrote: It also the same
I know it is very similar but the thing is there are functions in java that i used that are not present in c# also i am not an expert in c# so for example i don't know how to represent the car as a moving object on the screen...
thx
/\|-||\/|/\|)
|
|
|
|
|
Halawlaws wrote: for example i don't know how to represent the car as a moving object on the screen...
How did you represent a moving car on the screen in Java?
Best,
Jun
|
|
|
|
|
Jun Du wrote: How did you represent a moving car on the screen in Java?
With frames do i have frames in c#?
thx
/\|-||\/|/\|)
|
|
|
|
|
Windows Form in C# appears to be equivalent to Frame in Java.
Best,
Jun
|
|
|
|
|
If you create a new Windows Form, then use the event Paint.
private void Form1_Paint(object sender, PaintEventArgs e)
{
...
}
Then write your code in this method. For example :
private void Form1_Paint(object sender, PaintEventArgs e)
{
e.Graphics.DrawLine(new Pen(Brushes.Black, 1), 0, 0, 50, 50);
}
That code will draw a black line with width = 1, from (0,0) to (50,50)
|
|
|
|
|
I am working on a project
i have created 3 tiers:
presentation layer
datalinklayer
business logiclayer
i have a dropdownlist named Category_List resides in my login screen.I want to dynamically add the items to it .so i created a table called type which has a single field called Category.
now i want to bind my backend sql server with my application.
i am able to do it staight away in my asp.net application but what i want is that the connection string should be in a class file ,while the page loads the method that contains the connection string should be called and the items must get filled in my Dropdownlist.
iam unable to do it inthe class file,pl help me in doing so with helpof an example.
thank u
arun
|
|
|
|
|
What problem do you have in writing a class file? Would you please elaborate this?
Just add one class file in your web application, and define all data access functions in it.
Also you can define a function in the class that will dynamically fill the dropdown list by passing it as a parameter by reference.
Regards,
Ketan
|
|
|
|
|
[edit]I'm using .NET 1.1[/edit]
I have a date in the form of a string, in the American format, MM/DD/YYYY. How can I create a DateTime object from this string, irrespective of the current culture?
In other words, even if the current culture is French, the incoming string 11/03/2005 should be interpreted as Nov 03, 2005. I want to do this without changing the current culture.
I tried doing
DateTime suspDt = Convert.ToDateTime(strDate, new CultureInfo("en-US")); but that didn't work.
Thanks in advance!
Cheers,
Vikram.
"I am not Jesus and will never be. The fact is I was a piece of cr*p till I found Him." - Paul Selormey.
-- modified at 9:09 Tuesday 4th July, 2006
|
|
|
|
|
DateTime mydatetime = DateTime.Parse("11/03/2005");
|
|
|
|
|
Hi,
Try something like:
DateTime myDateTime = new DateTime(year,month,day);
The year,month and day can be substracted from the string if you know their exact position, using Substring and IndexOf. It helped me a lot sometimes. Hope it helps you.
Do your best to be the best
|
|
|
|
|
I was hoping there's a cleaner solution, but hey, your suggestion works.
Thanks a ton!
š
Cheers,
Vikram.
"I am not Jesus and will never be. The fact is I was a piece of cr*p till I found Him." - Paul Selormey.
|
|
|
|
|
Using .NET 1.1 and the following code:
string theDate = "11/03/2005";<br />
DateTime dt = Convert.ToDateTime(theDate, new System.Globalization.CultureInfo("en-US"));<br />
MessageBox.Show(dt.ToLongDateString());
Shows Nov 3 2005.
If I remove the culture info, and allow my local machine (UK) to decide, it gives March 11th. So basically that is exactly the desired behaviour!
What did you mean by:
Vikram A Punathambekar wrote: but that didn't work
It appears to work perfectly!
Current blacklist
svmilky - Extremely rude | FeRtoll - Rude personal emails | ironstrike1 - Rude & Obnoxious behaviour
|
|
|
|
|
J4amieC wrote: It appears to work perfectly!
I use the European format on my machine too, but it didn't work.
However, since then, I replaced the code with the DateTime(year, month, date) suggestion above and it works perfectly.
Thanks anyway!
š
Cheers,
Vikram.
"I am not Jesus and will never be. The fact is I was a piece of cr*p till I found Him." - Paul Selormey.
|
|
|
|
|
The magic word here is "appears", as you actually made a quite classic I18N error here. Don't worry, you are not the first one - and it won't fail on that many systems. What you really want to do is this:
new System.Globalization.CultureInfo("en-US", false);
Specifying "false" makes sure that you get the default en-US settings ignoring any changes done in the regional settings. Notice that if you do not run en-US regional settings you will always get the default - the potential problem is only for accounts configured with en-US settings and a changed date format.
|
|
|
|
|
|
Hi Folks,
i have a problem with common dialog', I need to open a file when i click the item from listbox. now i got open dialog with specified path but it dont open the file. can you plz give idea to solve this.
my code is here.,
the following code in selected index changed event for thet listbox.
OpenDialog.FileName="Filepath";
OpenDialog.OpenFile();
OpenDialog.ShowDialog();
ranandbe
|
|
|
|
|
??? I don't understand your code and what do you want to do with that, but normally I use it like this:
OpenFileDialog openFileDialog = new OpenFileDialog();
DialogResult dialogResult = openFileDialog.ShowDialog();
if(dialogResult == DialogResult.OK && openFileDialog.FileName != "")
{
} or
OpenFileDialog openFileDialog = new OpenFileDialog();
if(openFileDialog.ShowDialog() == DialogResult.OK)
{
System.IO.FileStream filestream = openFileDialog.OpenFile();
filestream.Close();
}
Before ShowDialog() you can only set the property like Path, Filter, etc...
Then you must call ShowDialog() to show the dialog. If the user select a file and click OK, then
you get a return value DialogResult.OK. Then you can get the filename by calling openFileDialog.FileName.
|
|
|
|
|
I am generating an Excel workbook from within a C# console app and wish to duplicate a worksheet which includes a pivottable. This however does not create a new pivotcache, so when the original worksheet is updated, the second is as well.
Does anyone know how I can separate the caches after they have been created? It is easy to link the new pivottable's pivotcache to a third pivotcache, but creating a new pivotcache without actually setting up a new pivottable seems impossible.
Thanks.
|
|
|
|
|
how can i read data about product from barcode and stoe it in data base
i hope an example becuase i am not profisional
then you for help
MD_NADA
|
|
|
|
|
Search CodeProject on the keyword "barcode" and you'll find articles that show how to work with barcodes.
:josh:
My WPF Blog[^]
|
|
|
|
|
How to add Application.config file for windows application project and how to access data from the file
Jey
|
|
|
|
|
Just select Add/New item (or something semantically equivalent - I don't have an english VS at hand) in your project and select Application configuration file. You'll get a file named "App.config" which is renamed to <YourExecutableName>.exe.config and copied to your output directory.
To access entries in the file you should take a look at the System.Configuration namespace.
Regards,
mav
--
Black holes are the places where god divided by 0...
|
|
|
|
|
I'm trying to display my desktop icon's in a listview with a transparant background. I want the icons to be perfectly visible and the white background color to blend in with the graphics below the form.
So actually setting ListView.BackColor to transparant would do the trick. But ListView.BackColor doesn't support transparancy.
Is there an other 'listview' component that does support transparancy, or any other way to achieve a transparant background below the icons?
Cheers, Richard
|
|
|
|