|
Probably your ArrayList is not created yet. Check if it's null first. Not created is not the same as empty.
|
|
|
|
|
In that case show your code and tell us what the exception says.
Giorgi Dalakishvili
#region signature
my articles
#endregion
|
|
|
|
|
I am developing an windows application where i have an MDI parent form that has menu strip i want that what ever option i have select from menu strip that may effect on MDI child form.
Suppose that
I have a label control on the child form i what to change the text color of that label then i have selected the option from menustrip that is in MDIparent so how can i show color dialog from MDI parent that can work for MDI Child form...
|
|
|
|
|
I would accomplish this with events. Create events for all toolbar buttons on the MDI parent and have the child forms listen to the events that they can make something out of. That way you do not need to check if the currently active child form can handle the function that the user is clicking.
|
|
|
|
|
Is any one can help me with this coding :
Thx
using System;
using System.Collections.Generic;
using System.Text;
using System.Collections;
namespace ApplicantTestin
{
/// The DataObject class stored with a key
class DataObject
{
// Populate
}
class Program
{
static Hashtable Data = new Hashtable();
static string[] StaticData = new string[] { "X-Ray","Echo","Alpha", "Yankee","Bravo", "Charlie",
"Delta", "Hotel", "India", "Juliet", "Foxtrot","Sierra",
"Mike","Kilo", "Lima", "November", "Oscar", "Papa", "Qubec",
"Romeo", "Tango","Golf", "Uniform", "Victor", "Whisky",
"Zulu"};
static void Main(string[] args)
{
for(int i=0;i<staticdata.length; i++)<br="" mode="hold"> Data.Add(StaticData[i].ToLower(), new DataObject(StaticData[i]) );
while(true)
{
PrintSortedData();
Console.WriteLine();
Console.Write("> ");
string str = Console.ReadLine();
string[] strs = str.Split(' ');
if(strs[0]=="q")
break;
else if(strs[0]=="print")
PrintSortedData();
else if(strs[0]=="inc")
Increase(strs[1]);
else if(strs[0]=="dec")
Decrease(strs[1]);
else if(strs[0] == "swap")
Swap(strs[1], strs[2]);
else if (strs[0] == "ref")
Ref(strs[1], strs[2]);
else if (strs[0] == "unref")
UnRef(strs[1]);
}
}
///
/// Create a reference from one data object to another.
///
/// <param name="key1" />The object to create the reference on
/// <param name="key2" />The reference object
static void Ref(string key1, string key2)
{
// Populate
}
///
/// Removes an object reference on the object specified.
///
/// <param name="key" />The object to remove the reference from
static void UnRef(string key)
{
// Populate
}
///
/// Swap the data objects stored in the keys specified
///
static void Swap(string key1, string key2)
{
// Populate
}
///
/// Decrease the Value field by 1 of the
/// data object stored with the key specified
///
static void Decrease(string key)
{
// Populate
}
///
/// Increase the Value field by 1 of the
/// data object stored with the key specified
///
static void Increase(string key)
{
// Populate
}
///
/// Prints the information in the Data hashtable to the console.
/// Output should be sorted by key
/// References should be printed between '<' and '>'
/// The output should look like the following :
///
///
/// Alpha...... -3
/// Bravo...... 2
/// Charlie.... <zulu>
/// Delta...... 1
/// Echo....... <alpha>
/// --etc---
///
///
static void PrintSortedData()
{
// Populate
}
}
}
|
|
|
|
|
1 - everyone wants help, 'help' is not an intelligent subject
2 - yes, we can help. What's the problem ? Oh, the problem is that you have a bunch of blank methods and hope we'll do your homework for you ? In that case, no.
Christian Graus
Please read this if you don't understand the answer I've given you
"also I don't think "TranslateOneToTwoBillion OneHundredAndFortySevenMillion FourHundredAndEightyThreeThousand SixHundredAndFortySeven()" is a very good choice for a function name" - SpacixOne ( offering help to someone who really needed it ) ( spaces added for the benefit of people running at < 1280x1024 )
|
|
|
|
|
alextheman wrote: Subject:Help
Never give subject line in that way. alswas try to put correct subject for your problem.
alextheman wrote: Is any one can help me with this coding :
How can some one help you with out knowing your problem?
Best Regards
-----------------
Abhijit Jana
Microsoft Certified Professional
"Success is Journey it's not a destination"
|
|
|
|
|
sorry, I newbie in programming, I still confuse about this code
if(strs[0]=="q")
break;
else if(strs[0]=="print")
PrintSortedData();
else if(strs[0]=="inc")
Increase(strs[1]);
else if(strs[0]=="dec")
Decrease(strs[1]);
else if(strs[0] == "swap")
Swap(strs[1], strs[2]);
else if (strs[0] == "ref")
Ref(strs[1], strs[2]);
else if (strs[0] == "unref")
UnRef(strs[1]);
I have already make some changes in the coding, like below :
I confuse what i should fill in Increase, Decrease and unref procedure
Thx
using System;
using System.Collections.Generic;
using System.Text;
using System.Collections;
namespace ApplicantTestin
{
/// The DataObject class stored with a key
class DataObject
{
// Populate
}
class Program
{
static Hashtable Data = new Hashtable();
static string[] StaticData = new string[] { "X-Ray","Echo","Alpha", "Yankee","Bravo", "Charlie",
"Delta", "Hotel", "India", "Juliet", "Foxtrot","Sierra",
"Mike","Kilo", "Lima", "November", "Oscar", "Papa", "Qubec",
"Romeo", "Tango","Golf", "Uniform", "Victor", "Whisky",
"Zulu"};
static void Main(string[] args)
{
for(int i=0;i<staticdata.length; i++)<br="" mode="hold"> Data.Add(StaticData[i].ToLower(), new DataObject(StaticData[i]) );
while(true)
{
PrintSortedData();
Console.WriteLine();
Console.Write("> ");
string str = Console.ReadLine();
string[] strs = str.Split(' ');
if(strs[0]=="q")
break;
else if(strs[0]=="print")
PrintSortedData();
else if(strs[0]=="inc")
Increase(strs[1]);
else if(strs[0]=="dec")
Decrease(strs[1]);
else if(strs[0] == "swap")
Swap(ref strs[1], ref strs[2]);
else if (strs[0] == "ref")
Ref(ref strs[1], ref strs[2]);
else if (strs[0] == "unref")
UnRef(strs[1]);
}
}
///
/// Create a reference from one data object to another.
///
/// <param name="key1" />The object to create the reference on
/// <param name="key2" />The reference object
static void Ref(ref string key1, ref string key2)
{
string key3;
key3 = key1;
key1 = key2;
key2 = key3;
}
///
/// Removes an object reference on the object specified.
///
/// <param name="key" />The object to remove the reference from
static void UnRef(string key)
{
// Populate
}
///
/// Swap the data objects stored in the keys specified
///
static void Swap(ref string key1, ref string key2)
{
string key3;
key3 = key1;
key1 = key2;
key2 = key3;
}
///
/// Decrease the Value field by 1 of the
/// data object stored with the key specified
///
static void Decrease(string key)
{
// Populate
}
///
/// Increase the Value field by 1 of the
/// data object stored with the key specified
///
static void Increase(string key)
{
// Populate
}
///
/// Prints the information in the Data hashtable to the console.
/// Output should be sorted by key
/// References should be printed between '<' and '>'
/// The output should look like the following :
///
///
/// Alpha...... -3
/// Bravo...... 2
/// Charlie.... <zulu>
/// Delta...... 1
/// Echo....... <alpha>
/// --etc---
///
///
static void PrintSortedData()
{
Console.WriteLine();
}
}
}
|
|
|
|
|
1 - are you using an ld version of .NET ? If not, use generic containers, always.
2 - like I said, we're not going to write the code for you. Write some code and ask specific questions when you get stuck. Working out what to do, is half of the reason you were given this homework.
Christian Graus
Please read this if you don't understand the answer I've given you
"also I don't think "TranslateOneToTwoBillion OneHundredAndFortySevenMillion FourHundredAndEightyThreeThousand SixHundredAndFortySeven()" is a very good choice for a function name" - SpacixOne ( offering help to someone who really needed it ) ( spaces added for the benefit of people running at < 1280x1024 )
|
|
|
|
|
If you don't understand the question ask your teacher. If you do understand it then work out what to do, I rather suspect the clue is in the method name and description -
alextheman wrote: ///
/// Decrease the Value field by 1 of the
/// data object stored with the key specified
///
static void Decrease(string key)
{
// Populate
}
Bob
Ashfield Consultants Ltd
|
|
|
|
|
hi i want to display the IL( intermediate language) from assembly.
have any tricks?
My small attempt...
|
|
|
|
|
|
its a third party tool na..
i want to do it from my test application
My small attempt...
|
|
|
|
|
|
ILDASM.EXE comes with Visual Studio.
Pits fall into Chuck Norris.
|
|
|
|
|
Hello everyone,
I am new to how to use C# to calculate hash value for a string. I want to check we normally use MD5CryptoServiceProvider.ComputeHash?
As described here?
http://support.microsoft.com/kb/307020/en-us
thanks in advance,
George
|
|
|
|
|
What's wrong with the gethash method that's built in ?
You can use any method you like, but I would agree you should use a built in crypto class, if you want something other than the built in method.
Christian Graus
Please read this if you don't understand the answer I've given you
"also I don't think "TranslateOneToTwoBillion OneHundredAndFortySevenMillion FourHundredAndEightyThreeThousand SixHundredAndFortySeven()" is a very good choice for a function name" - SpacixOne ( offering help to someone who really needed it ) ( spaces added for the benefit of people running at < 1280x1024 )
|
|
|
|
|
Thanks Christian,
Do you have a sample for gethash? I can not find one from MSDN or Google.
regards,
George
|
|
|
|
|
GetHashCode is a method on all objects in .NET
Christian Graus
Please read this if you don't understand the answer I've given you
"also I don't think "TranslateOneToTwoBillion OneHundredAndFortySevenMillion FourHundredAndEightyThreeThousand SixHundredAndFortySeven()" is a very good choice for a function name" - SpacixOne ( offering help to someone who really needed it ) ( spaces added for the benefit of people running at < 1280x1024 )
|
|
|
|
|
Thanks Christian,
Question answered. I searched for "gethash" other than "GetHashCode" before, so no samples are found.
have a good weekend,
George
|
|
|
|
|
George_George wrote: use MD5CryptoServiceProvider.ComputeHash?
MD5 is weak. There are many algorithms available to get the original string from a MD5 hash. You may consider using SHA . There are different types like SHA256 , SHA384 , SHA512 etc. Here is an example which uses SHA512 to hash.
string stringToBeHashed = "Hello";
byte[] bytesToBeHashed = Encoding.ASCII.GetBytes(stringToBeHashed);
SHA512 sha = new SHA512Managed();
byte[] hashedBytes = sha.ComputeHash(bytesToBeHashed);
string hashedString = Convert.ToBase64String(hashedBytes); Hope this helps
|
|
|
|
|
Cool, N a v a n e e t h!
regards,
George
|
|
|
|
|
It depends on whether you need a cryptographically strong hash or not.
.GetHashCode is fast and quite weak (its easy/more likely to find something with the same hash).
The CSPs are a lot slower but generate much stronger hashes.
|
|
|
|
|
Thanks Mark,
CSP you mean Crypto Service Provider? Or? For example, C# class do you refer?
regards,
George
|
|
|
|
|
Yep the crypto service providers.
|
|
|
|
|