|
we should not encourage unnecessary replies, that why i did it...
Yes you got my correct question.. Now I want to know in what situation I can not replace Hashtable with Dictionary. Please put some more lights
My small attempt...
|
|
|
|
|
i think i got it finally
Here it is
My small attempt...
|
|
|
|
|
That's a nice explanation, thanks for the link
I are Troll
|
|
|
|
|
Eddy Vluggen wrote: That's a bit rude
He was only responding to the rudeness of nagendrathecoder.
|
|
|
|
|
PIEBALDconsult wrote: He was only responding to the rudeness of nagendrathecoder.
You're right. I don't know why I fell over this particular post, must have been the phrasing or the mondays.
FWIW, I don't like the "just Google it"-answers either, but I have to admit that those links have helped me once or twice - just by having the correct searchterm.
I are Troll
|
|
|
|
|
Eddy Vluggen wrote: just by having the correct searchterm.
Absolutely, some times you don't know the proper terms to ask for. But that doesn't seem to be the case here, it looks like the poster had already read a bunch of such articles, but was looking for more.
|
|
|
|
|
What is the latest C# version? is it same as the .net version number??
ie C# comes with .net4.0 is C#4.0. Is it like that?
My small attempt...
|
|
|
|
|
Latest version of c# is 4.0.
Yes, you are right, c# 4.0 comes with Visual Studio 2010 (.Net Framework 4.0).
|
|
|
|
|
sujithkumarsl wrote: Is it like that?
For .Net 4.0 this is the case i.e. C# 4.0 comes with .Net 4.0. The CLR for this has also been given the version number 4.0.
However, C# 3.0 worked on CLR 2.0 and Framework 3.5.
So version numbers need not necessarily be same.
|
|
|
|
|
Thank you for the answers.... It was an interview question... i said the latest is C#4.0 but he was not convinced
My small attempt...
|
|
|
|
|
I'm relatively new to using DataSets and DataAdapters so I have a few questions...
Can someone explain to me exactly what the TableMappings property does in a DataAdapter? The MSDN doesn't quite explain it well enough for me.
If I have a dataset filled with a subset of data from a given table, can I call fill again on that same dataset to pull in more data from that same table? If so, can I just use the fill function again in the same way with a different command or what?
Thanks,
Sam.
|
|
|
|
|
Nevermind... I figured it out.
|
|
|
|
|
Good Afternoon,
I posted this in General Databases earlier, but am not sure if is instead a C# problem since I am actually writing an application, so I am posting it here as well.
I used a nice SQL insert/update program for years with MSSQL 2000, but was never able to get it past security to make it work with 2005. This weekend, out of frustration, I decided to take a shot at writing one of my own. In doing so, I attempted to list the databases that were on the server. I first tested the command in the Query analyzer and it worked fine, returning all the names of the databases. However, when I tried to use the exact same code in the application, every database name comes up as "master" in the array, so I cannot continue to propagate the tables without a named database. I cannot understand how the identical code can return different results in different places. Here is the code.
Appreciate your assistance....Thank you, Pat
string Sql = "SELECT name FROM sys.databases";
SqlCommand Comm = new SqlCommand(Sql, Conn);
SqlDataAdapter da = new SqlDataAdapter(Comm);
DataSet ds = new DataSet();
da.Fill(ds);
int cnt = ds.Tables[0].Rows.Count;
string[] dbs = new string[cnt];
for(int i = 0; i < cnt; i++)
{
dbs[i] = ds.Tables[0].Rows[0]["name"].ToString();
}
foreach(string s in dbs)
{
databases.Items.Add(s);
}
|
|
|
|
|
You may want to consider using SMO for this kind of stuff - see this[^] article.
/ravi
|
|
|
|
|
Ravi..thank you for answering my question. I did get that code to work, but I had to add another reference. Although it finally did work, there was a different problem, but before I could finish it, I (actually one of you guys) found the error in the original code...simply replacing the string Rows[0] with Rows[i] fixed everything. I cannot believe I did not notice that! I am going to work on the other solution though, just in case I need to use at another time. Thank you again for your suggestion. Your time is appreciated! Best Regards, Pat
|
|
|
|
|
for(int i = 0; i < cnt; i++)
{
dbs[i] = ds.Tables[0].Rows[0]["name"].ToString();
} Wouldn't that stuff dbs with the first row?
for(int i = 0; i < cnt; i++)
{
dbs[i] = ds.Tables[0].Rows[i]["name"].ToString();
}
I are Troll
|
|
|
|
|
YES YES YES! Sometimes I am STUPID STUPID STUPID....I am looking right at it but still don't see it. Thank you for pointing this out. My mind must be someplace else. I appreciate your clear and accurate observation AND I have marked your answer as correct. The rest of the code is perfect and the app is working as designed. Best Regards, Pat
|
|
|
|
|
PDTUM wrote: I am looking right at it but still don't see it.
Take a long essay and have someone change a single character; it'll be very hard for your mind to register the typo, because your brain will try to correct what it sees. Once you know what word is expected, the brain only registers the word and no longer the individual letters.
PDTUM wrote: the app is working as designed
Wish I was too
I are Troll
|
|
|
|
|
Hello everyone ,
i am designing an image annotation tool .
In any image annotation tool , it enables you to drag a rectangle which for example shows an image , text or any other stuff inside of it , then when you click and drag the rectangle resizes itself accordingly over the shown image .
The question is :
which is the best programming practice for this task ???? , is it either to create a rectangle and keep track of the x,y coordinates and change the size of the rectangle accordingly ????
or
to inherit from the CONTROL Class and implement its methods like onMouseDown , OnMouseMove ....etc ????
Second thing ..... :
i need to know how can i place handles surrounding the rectangle ? and enable the user to change its Size according to its movement either to the right , left , top or bottom .?????
any help or existing examples to see ...
Any help will be greatly appreciated....
Thank you
Human knowledge belongs to the world.
|
|
|
|
|
I would be tempted to create a rectangle control here. The interaction logic for sizing/moving the rectangle would be contained in this class, then all your image control would need to do would be to hold references to the rectangle. The rectangle drawing could implement a simple handle drawing algorithm which drew a square at the corners.
If you want to see some sample code that does this, you can take a look at the Netron library here[^].
"WPF has many lovers. It's a veritable porn star!" - Josh Smith As Braveheart once said, "You can take our freedom but you'll never take our Hobnobs!" - Martin Hughes.
My blog | My articles | MoXAML PowerToys | Onyx
|
|
|
|
|
Netron Library couldn't be downloaded ..
if you have it , please send me a working download link .
so for good programming practice, you recommend me to create a rectangle object not to inherit from the control class and do the work inside ???? did i understand you correctly ?
Human knowledge belongs to the world.
|
|
|
|
|
You did. If the link isn't working there, there's a version on Sourceforge[^].
"WPF has many lovers. It's a veritable porn star!" - Josh Smith As Braveheart once said, "You can take our freedom but you'll never take our Hobnobs!" - Martin Hughes.
My blog | My articles | MoXAML PowerToys | Onyx
|
|
|
|
|
When in doubt, I'm inclined to not use Controls and create my own classes of visible, drawable, movable parts. Takes some more code, but leads to snappier behavior as soon as you need lots of them. It also could offer more functionality, e.g. an easier selection of objects (select nearest, select by clicking through hollow shapes, etc).
As I understand your requirements (only a few controls involved), it wouldn't matter much, provided you don't get into transparency problems.
Luc Pattyn [Forum Guidelines] [Why QA sucks] [My Articles]
I only read formatted code with indentation, so please use PRE tags for code snippets.
I'm not participating in frackin' Q&A, so if you want my opinion, ask away in a real forum (or on my profile page).
|
|
|
|
|
I believe you're looking for a C# version of a CRectTracker [^]. See this[^] article.
/ravi
|
|
|
|
|
Hello everybody!
I developed (up to alpha stage, at this moment) a picture browsing application for .NET 2.0 and released it under GPL v3.
Explanatory article
Google Code page
I tried to execute it on Mono to no avail. Even though the application runs, certain features do not work as expected, especially key presses and the full screen mode.
I also tried compiling it with Mono's C# compiler using Monodevelop. Although the compilation completed successfully, the newly-built application simply crashed on load.
After searching on the Mono project page, I found out that Windows Forms in the latest Mono version is considered to be 100% compatible with the corresponding MS implementation. Still, my Winforms app simply refuses to run correctly on Ubuntu, while running as expected on Windows.
Does anyone know of possible fixes to my emerging program, outside of shifting to GTK#?
All the best,
Mihnea
modified 20-Aug-18 21:01pm.
|
|
|
|