|
Can anyone help me in retriving the value from a hash table..in c#
Thanls
Nithya..
|
|
|
|
|
Use the indexing operator. Like this
void SomeFunc(Hashtable table)
{
object val = table[key];
}
<pre>
Regards
Senthil
_____________________________
<font face="Verdana" size="1"><a href="http://blogs.wdevs.com/senthilkumar">My Blog</a> | <a href="http://www.codeproject.com/script/articles/list_articles.asp?userid=492196">My Articles</a> | <a href="http://geocities.com/win_macro">WinMacro</a></font>
|
|
|
|
|
hi,
I would like to find an example of drawing curves. I have to make a data curves diagram like window's RGB Color curves. I had tried to use the drawCurves function, however, it seems cannot draw a smooth curves .
so does anyone has this experience? or do you know where can I find a similar example?
Thanks.
|
|
|
|
|
do I need some equations if I want to draw a R,G,B color curves.
I hope to pick up a color by adjusting the curves.
|
|
|
|
|
How can i release memory allocated by new operator by myself?is there any keyword available to do it?
Thanks
Nithya..
|
|
|
|
|
No, there isn't.
Memory is released after it's no longer needed, i.e. every reference to an object instance has been removed, nothing you can do about it.
Btw. why would you want to handle memory allocation yourself?
mav
|
|
|
|
|
Thanks for the reply.i am allocating memory inside a loop so i tried to release it when i dont want..
Thanks
Nithya..
|
|
|
|
|
You don't need to do anything, when the object has no live references to it, the GC (Garbage Collector) will automatically clean it up.
Regards
Senthil
_____________________________
My Blog | My Articles | WinMacro
|
|
|
|
|
Let's see the code. Then the replies can be more to the point.
On Disposable objects you can use the [b]using[/b] keyword.
Are you trying to solve a real problem (performance, memory?), or is this just latent anal-retentiveness of a recovering c/c++ programmer?
Matt Gerrans
|
|
|
|
|
In Outlook it's able to create a lot of calendars... So, if my program writes a date in de calendar, it writes the date in the main calendar. How can I write my date in one of the other calendars?
Thanks for your help!
|
|
|
|
|
Hi!
Can you explain to me how I can handle events in Outlook? I have no idea...
I want to catch calendar-events. So, if somebody deletes or writes dates, I want to know which date the user has deleted or written.
I couldn't find any examples...
Thanks for your help!
|
|
|
|
|
Did you try searching for "Outlook Automation"? Maybe you'd get a few pointers there.
Regards
Senthil
_____________________________
My Blog | My Articles | WinMacro
|
|
|
|
|
Hi all,
While reading this tutorial, I encountered this:
<br />
class SplashScreen : System.Windows.Forms.Form<br />
{<br />
...<br />
static SplashScreen ms_frmSplash = null;<br />
...<br />
}<br />
And I'm a bit worried because of this statement. How can a class have a property of itself? Or the static keyword makes it not act as a class property? Thanks.
|
|
|
|
|
ms_frmSplash is a *reference* to a SplashScreen object, not a SplashScreen object itself. If you had a SplashScreen object itself, then it would be a problem, the compiler wouldn't be able to generate the object layout without going into infinite recursion. References are of a fixed size (regardless of the referenced object), so the compiler has no problem with the above code. The static keyword has nothing to do with that.
The code that you posted is very similar to something like this in C++
class Node
{
Node *p;
};
Regards
Senthil
_____________________________
My Blog | My Articles | WinMacro
|
|
|
|
|
First, to correct the words that you are using, this is not a property, it is called a field in .NET (although many ex-C++ developers will call it a member variable).
1nsp1r3d wrote:
How can a class have a property of itself?
A class can have "fields" of any type. Including itself. As to how? Well, the code snipped you gave shows you how.
1nsp1r3d wrote:
Or the static keyword makes it not act as a class property?
The static keyword makes the "field" available at the class level rather than at the object instance level.
A better question would have been "why did they do this?"
If you are creating a "singleton" (that is a class that only ever has one instance through the lift of the application) then you need to create a static reference to the one and only instance of the class in the class.
If an object is part of a chain of object then it will need to reference another object of the same type. For example, the "decarator pattern" does this.
Does this help?
My: Blog | Photos
WDevs.com - Open Source Code Hosting, Blogs, FTP, Mail and More
|
|
|
|
|
Thanks go to both of you
|
|
|
|
|
About optimisation...
I usend the CMemFile in C++ to read full file into the memory, and then worked with the memory like with file...
I would like to use this way here... So, how to read the file into the memory and then create BinaryReader to this block of memory... I think there must be some method to convert from byte array to ByteStream....
Please Help...
|
|
|
|
|
You're looking for the
System.IO.MemoryStream class.
Regards
Senthil
_____________________________
<font face="Verdana" size="1"><a href="http://blogs.wdevs.com/senthilkumar">My Blog</a> | <a href="http://www.codeproject.com/script/articles/list_articles.asp?userid=492196">My Articles</a> | <a href="http://geocities.com/win_macro">WinMacro</a></font>
|
|
|
|
|
I wiold like to do paging say by 1 , 2, 3 or next/Previous in datagrid (In Win form application)
Any Input or Sample code please?
|
|
|
|
|
It would ask a lot of work, but you can do the following:
Create two datasets, one dataset has all the data, the second one only has the records to view (one page at a time).
page = 30 records (begins at 0)
beginrecord = page * 30
endrecord = (page * 30) + 30
Every time you go to the next or previous page execute the following procedure for the new page (clear the view dataset first):
string configuredTable = "MyTable";
DataSet myDataSet = new DataSet();
for(int index = beginrecord; index < endrecord; index++)
{
DataRow newrow = viewdataset.Tables[configuredTable].NewRow();
viewdataset.Tables[configuredTable].AddRow(newrow);
}
viewdataset.AcceptChanges();
walk through the dataset table with the records you want to display and add them to a separate dataset. (Don't forget to call AcceptChanges() )
There's one problem though: You should not edit the records in the view dataset, because that one gets cleared every time you change the page. Ofcourse you can implement the DataRowAdded eventhandler and add the same data to the non-view dataset.
WM.
What about weapons of mass-construction?
|
|
|
|
|
HellO!
Who knows ESRI Shape file format, will understand my problem...
I got a shape file, where some integers are in little endian format and other are in big endian format... So, my question is - how to convert this two formatsa between each other? For example i have an integer a in BigEndian format, i'd like to see it in Little Indian format... Thaks...
|
|
|
|
|
Converting from big endian to littel endian is just a matter of reversing the bytes, isn't it? You can do that easily with code like this.
int ReverseBytes(int original)
{
int reversed = 0;
for (int i = 0; i<4; i++)
{
reversed |= (byte)(original & 0x000000FF);
reversed << 8;
original >> 8;
}
return reversed;
}
Regards
Senthil
_____________________________
My Blog | My Articles | WinMacro
|
|
|
|
|
Small correction...if you loop 4 times you drop bytes off the right hand side of the reversed integer, so it should be like this (note also use of unsigned):
<br />
<br />
unsigned int reversed = 0;<br />
<br />
for (int i = 0; i<3; i++)
{<br />
reversed |= (BYTE)(original & 0x000000FF);<br />
reversed = reversed << 8;<br />
original = original >> 8;<br />
}<br />
<br />
<br />
reversed |= (BYTE)(original & 0x000000FF);<br />
|
|
|
|
|
Yeah, you were right, there was an off by one error. Here's the right code.
int reversed = 0;
for (int i = 0; i<4; i++)
{
reversed <<= 8;
reversed |= (byte)(original & 0x000000FF);
Console.WriteLine("{0:x}", reversed);
original >>= 8;
}
Regards
Senthil
_____________________________
My Blog | My Articles | WinMacro
|
|
|
|
|
Apologies, my previous post had a small bug which caused an extra left shift to occur. Here's the correct code
int reversed = 0;
for (int i = 0; i<4; i++)
{
reversed <<= 8;
reversed |= (byte)(original & 0x000000FF);
original >>= 8;
}
Regards
Senthil
_____________________________
My Blog | My Articles | WinMacro
|
|
|
|