|
I assume you're missing a aButton = new Button(); from your code somewhere?
If you are dynamically creating buttons in your loop you will need to keep a reference to them to be able to access them again. Putting them in an ArrayList is usually a good solution. Another way to do it would be to iterate through your form's ControlCollection and find your buttons again which is also an option, but if you have a lot of other controls it isn't very efficient. Another alternative would be to add a group box or a panel to your form and put all your buttons in there.
|
|
|
|
|
Yes Wjousts you are right that line disapeard for some reason while I pasted the code.
The arrayList sounded very good but I didn't realy got it to work.
I just triead a simple thing like hidding one button:
btnList[1].Visible=false;
but got an error message saying:
'Object does not contain a definition for visible'
I created the list like this:
ArrayList btnList = new ArrayList();
and add buttons to it like this:
btnList.Add(aButton);
|
|
|
|
|
The problem is that the array list contains objects, not buttons. btnList[1] returns an object that happens to be a button and you are responsible for casting it back to a button. In other words, like this:
<br />
Button b = (Button)btnList[1];<br />
b.Visible = false;<br />
|
|
|
|
|
That explains it =) Thanks alot for the help
|
|
|
|
|
Does anybody know if it's possible to pass a parameter to a remote object constructor using .NET remoting withing having access to the remote objects themselves?
I have a server solution that contains a project with remote objects and a project with remote interfaces, of which the remote objects implement. My client solution only contains the remote interfaces project. I'm currently getting a reference to the interface using the Activator.GetObject() method and making calls on the remote objects. However, I now have a need to pass a parameter into the constructor of the remote object and the only way I can determine that will work is if I share my remote objects project in my client solution, which I don't want to do. Any ideas?
|
|
|
|
|
Adding "constructor parameters" to Activator.GetObject() or any of the .Net Remoting associated calls would add unneeded complexity to .Net Remoting (more on the server side than the client side). If you really need this kind of functionality, I suggestion is just make another initializer function uninispiringly called Initialize that can be overloaded to take any number of params you want.
|
|
|
|
|
That's not good enough because the remote objects are defined to be SingleCall rather than Singletons. If I call Initialize and initialize some variable on the server, it won't be set when I make the second call.
|
|
|
|
|
I assume that what System.Activator.GetObject(Type, String, Object) overload is for. Look in the docs for a special constructor like ISerializable has.
xacc-ide 0.0.99-preview7 now with C#, C, C++, IL, XML, Nemerle, IronPython, Perl, Caml, SML, Ruby, Flex, Yacc, Java, Javascript, Lua, Prolog and Boo highlighting support!
|
|
|
|
|
Write two functions that accept three arrays as function arguments. All three arrays should be created in the main(). First, prices should be initialized with the following vaules: 9.92, 6.32, 12.63, 5.95, and 10.29 in the main(). Second, the units array should be populated using a loop and the user input from the console in the main(). The first function should store the product of the corresponding values in the prices and units arrays in the amounts array (ex. amounts[1] = prices[1] * units[1]). The second function has to display the report when called?
|
|
|
|
|
|
so what is ur question here?
You might try this ur self first....
<< >>
|
|
|
|
|
Thanks for posting your homework question here. However, no-one here is going to do this for you, and if we did, what would you do when your next assignment comes along.
This looks pretty trivial to me, if you don't understand the task, go and ask your lecturer. If, once you've tried to make it work, you still can't get it right, feel free to ask questions here. Specific questions that show you're trying to learn, and not just trying to get a free ride off the internet.
Christian Graus - Microsoft MVP - C++
|
|
|
|
|
Exactly where are you stuck? The code for this should be very trival, are you having difficult with the coding or with parsing the question?
|
|
|
|
|
Is there anything such class, or will I have to write my own?
|
|
|
|
|
The class System.IO.Path has several static methods that can help you get any of the parameters returned from _splitpath.
|
|
|
|
|
Hi,
for a database table having a foreign key refered to
another table, what advantage will it gain to have
the foreign key ? Will it faster in joining the refered
and referring table ? or something else ?
Thanks
|
|
|
|
|
Typically they are used for inner joins to prevent cartesian products
|
|
|
|
|
foreign keys are used for checking references between records in different tables. With a constraint defined a record cannot be removed as there is a reference to a record in an another table.
'A programmer ist just a tool which converts caffeine into code'
|
|
|
|
|
Thanks.
So what will happen in the database if the foreign key relation
are violate in MySQL, will the database return an exception or something else ?
|
|
|
|
|
In that case database suppose to give constraint error.
- ashish
|
|
|
|
|
Hi
For the database reader e.g. dr.GetInt32(column0),
what will it get if the database record value is null for the column ?
Will it get 0 ?
Thanks
|
|
|
|
|
It should throw an InvalidCastException if the column is null. You need to check for null before attempting the cast.
|
|
|
|
|
sorry,
I just mean that the cell in database is null, but not the column is null, so will it return zero ?
|
|
|
|
|
You'll get an exception. 0 is a perfectly valid value, and NULL means no value at all. So, you have to use the IsDBNull method to determine if a field is null .
int ordAge = rdr.GetOrdinal("Age");
if(!rdr.IsDBNull(ordAge))
{
Console.WriteLine("Age: {0}", rdr.GetInt32(ordAge));
}
else
{
Console.WriteLine("No age specified.");
} -- LuisR
Luis Alonso Ramos
Intelectix - Chihuahua, Mexico
Not much here: My CP Blog!
The amount of sleep the average person needs is five more minutes. -- Vikram A Punathambekar, Aug. 11, 2005
|
|
|
|
|