|
I have tried using Dictionary<string, list<float,="" float="">> = new Dictionary <string, list<float,="" float="">>(); but i get a compliation error
using the generic type 'System.Collections.Generic.List<t>' requires '1' type arguments
Any ideas.
Thanks
|
|
|
|
|
The syntax in your post is screwed up,
if you want to display > you have to type & g t ; (without the spaces) and similar for < as Code Project renders like web page
I can't help until I get the correct code, but it sounds like you are not declaring the generic properly. You can see examples in the previous posts.
CCC solved so far: 2 (including a Hard One!)
|
|
|
|
|
static Dictionary<string, List<float, float>> drive = new Dictionary<string, List<float, float>>();
this is the syntax im using.
Thanks for the help
|
|
|
|
|
The nested generic syntax is very powerful, but ugly (but I think there is no rational way around that problem) so errors are often difficult to spot, especially if you haven't used them very much.
The problem in the code snippet is List<float,float> you can only have one generic type in a list (e.g.
List<float> If you want to store two floats this way, you need to create a class with two float properties (Like the example I posted yesterday) e.g.
public class Foo
{
public float Value1 { get; set; }
public float Value2 { get; set; }
}
public class Program
{
public void Main()
{
Dictionary<string, List<Foo>> Bar = new Dictionary<string, List<Foo>>();
}
}
I suggest you research both generics, and the various common collection types (e.g. List, Collection, Dictionary, Linked List, Hashtable, Set etc.). The .Net framework doesn't have all these (e.g. I've had to implement a Set type), but a grounding in each will let you know when to use it and will stand you in good sted in your career.
CCC solved so far: 2 (including a Hard One!)
|
|
|
|
|
I use C# express edition 2008,windows XP sp2.
if In rowheader a datagridview i keydown delete key,I want the row to be deleted.
but i cannot trap the keydown event,
my question is how to do that.
thank you
han
han
|
|
|
|
|
If you have the AllowUserToDelete property (that may not be the exact name but it is pretty close, I'm doing this from memory) set to true then Ctrl-Del should do what you want.
Hope that this helps.
Henry Minute
Do not read medical books! You could die of a misprint. - Mark Twain
Girl: (staring) "Why do you need an icy cucumber?"
“I want to report a fraud. The government is lying to us all.”
|
|
|
|
|
Hello Henry
thank you ,it work.
han 
|
|
|
|
|
Hi,
I Build an application with timer that is checking every second (on_Tick event)
if the second eq to "00",
and if it's true a messagebox launch with some message.
My problem is - if the user dosen't press OK the message will show again at the next minute (when the second will eq to "00").
How can i launch the messagebox only if there isn't any othere nessagebox.
10x
|
|
|
|
|
You'd have to either stop the timer until the message box has been shown, or you'd have to write your own message box class so you can set some sort of flag.
Christian Graus
Driven to the arms of OSX by Vista.
Read my blog to find out how I've worked around bugs in Microsoft tools and frameworks.
|
|
|
|
|
Christian Graus wrote: you'd have to write your own message box class so you can set some sort of flag.
But if i'll stop the timer i don't think i can start it again,
can i?
and how i can check if the user press OK, with the Dialog Result?
Christian Graus wrote: or you'd have to write your own message box class so you can set some sort of flag.
Can I overrite it?
can you please explain me have to do it?
|
|
|
|
|
tamir901 wrote: But if i'll stop the timer i don't think i can start it again,
can i?
Why not ?
tamir901 wrote: and how i can check if the user press OK, with the Dialog Result?
A message box only has one button. So you show it, and the next line of code restarts the timer.
i think you need to buy a book, desperately.
tamir901 wrote: can you please explain me have to do it?
You either stop the timer, or you write your own dialog box. If you don't know how to create a form, you REALLY need to buy a book. The point is that your dialog box would include a flag, which is set to true while the form is visible, or you could just show and hide a static instance and check if it's visible directly.
Christian Graus
Driven to the arms of OSX by Vista.
Read my blog to find out how I've worked around bugs in Microsoft tools and frameworks.
|
|
|
|
|
tamir901 wrote: But if i'll stop the timer i don't think i can start it again,
can i?
Yes, see below.
tamir901 wrote: and how i can check if the user press OK, with the Dialog Result?
Yes, just get back the DialogResult and compare it to one of the values in the DialogResult enum.
I don't mean to be doing your homework for you, but sometimes seeing it in code can make it easier to understand:
if (myCondition) {
timer1.Stop();
DialogResult result = MessageBox.Show("here is my message", "caption", MessageBoxButtons.OKCancel);
if (result == DialogResult.OK) {
} else {
}
timer1.Start();
}
Christian Graus wrote:
or you'd have to write your own message box class so you can set some sort of flag.
tamir901 wrote: Can I overrite it?
You could, but it's a lot easier just to follow Christian's first suggestion and stop and start the timer.
|
|
|
|
|
Hello everybody
Is possible to push a code project to a database server? The project has built in .Net framework that is .aspx, and it has written in c#. The server has no visual studio environment, it is just database server and contains Ms_Sql. If there is any clarity problem in my question I try to explain briefly. I forgot something, is the project should be published using publisher?
Thanks
|
|
|
|
|
|
If you don't even know what ASP.NET is called, I have to wonder what it is you've created.
Christian Graus
Driven to the arms of OSX by Vista.
Read my blog to find out how I've worked around bugs in Microsoft tools and frameworks.
|
|
|
|
|
Hi, Guys, I am trying to write a code in Visual Studio 2008(C#) to open up a dialog box for user to select an image and save the image into a folder where the path can be used later in the code for later retrieval. Can anyone help me with a code. I will appreciate it very much.
|
|
|
|
|
Try the following... I think you will get an idea.
An Easy Way to Resize an Image
Thanks
Md. Marufuzzaman
Don't forget to click [Vote] / [Good Answer] on the post(s) that helped you.
I will not say I have failed 1000 times; I will say that I have discovered 1000 ways that can cause failure – Thomas Edison.
|
|
|
|
|
Can some one give me an example to show how to access C# objects from PowerShell Script?
|
|
|
|
|
First google hit[^]
Christian Graus
Driven to the arms of OSX by Vista.
Read my blog to find out how I've worked around bugs in Microsoft tools and frameworks.
|
|
|
|
|
Hi,
I am fighting with SQL syntax.
My database is MDB file, all reading work fine except
DateTime columns.
this code:
string cmdR = "select M_TEMP from MEASUREMENT where M_TIME = '2007-11-16 13:10:00'";
using (OdbcCommand catCMD = new OdbcCommand(cmdR, mConn))¨
OdbcDataReader myReader = catCMD.ExecuteReader();
...
give me exception (ExecuteReader()): System.Data.Odbc.OdbcException
with error: Data type mismatch in criteria expression.
I tried various combination,
for 'M_TIME = #'2007-11-16 13:10:00'#
then error was:
Syntax error in date in query expression 'M_TIME = #'2007-11-16 13:10:00'#'
The closest probably was
'M_TIME = #2007-11-16 13:10:00#
there were no exception but it select the first item except the one from the requsted time
and i am still not able to find the way to insert time in correct way.
Thank you for help to undertand this
Viliam
viliam
|
|
|
|
|
Looking at this[^] you may find that
string cmdR = "select M_TEMP from MEASUREMENT where M_TIME = ts'2007-11-16 13:10:00'";
using (OdbcCommand catCMD = new OdbcCommand(cmdR, mConn))
{
OdbcDataReader myReader = catCMD.ExecuteReader();
...
} may work - I don't know for sure, (I don't use ODBCas my DBs are mySQL)
Oh, and the convention for database access seems to be:
string cmdR = "SELECT field FROM table WHERE field = value";
No trees were harmed in the sending of this message; however, a significant number of electrons were slightly inconvenienced.
This message is made of fully recyclable Zeros and Ones
|
|
|
|
|
Thank you but there is still the exception
Syntax error (missing operator) in query expression 'M_TIME = ts'2007-01-12 13:10:00''.
viliam
|
|
|
|
|
I got a problem here. any help will be appreciated.
Currently, I am developing a windows application and I want to display another form when a user clicks on a certain button. so that when the new form is displayed the following conditions must be full filled...
1. the to be displayed form should have only one instance, meaning if the form is already displayed there is no need to display it again.
2. The to be displayed form should be a child form to the MDI form.
Kind Regards.
|
|
|
|
|
you should consider investing in a book on C# and Winforms programming.
You basically create it as a member variable, and check if it's visible, and if not, show it.
Christian Graus
Driven to the arms of OSX by Vista.
Read my blog to find out how I've worked around bugs in Microsoft tools and frameworks.
|
|
|
|
|
Try the following..
<PRE>
rootInterface IRootInterface = new rootInterface();
IRootInterface.MdiParent = this;
IRootInterface.Show();
</PRE>
Thanks
Md. Marufuzzaman
Don't forget to click [Vote] / [Good Answer] on the post(s) that helped you.
I will not say I have failed 1000 times; I will say that I have discovered 1000 ways that can cause failure – Thomas Edison.
|
|
|
|