|
Did you post this only as information, or do you have a question also?
If you don't make
a line break every
other word, it's
much easier to
read what you
write.
What is it that you want to convert, and how?
---
b { font-weight: normal; }
|
|
|
|
|
To get the value in a Hashtable you use a string: Hashtable["myString"].ToString().
I want to be able to change "myString" to a variable so that I can create a method where "myString" can change based on the variable being passed.
Thanks again.
|
|
|
|
|
Yes, that is what you did in the code that you showed. Is there a problem with this?
---
b { font-weight: normal; }
|
|
|
|
|
I'll have to retest. I'm pretty sure I got an error. Since I'm up against a deadline, I just figured out a different way of accomplishing the same thing.
Thanks for your help.
|
|
|
|
|
Hi All,
Given:-
class A
{
}
class DerivedFromA : A
{
}
If i have an instance of A, but i want to "upgrade it" to be a DerivedFromA, is there any way to do that? C# doesn't seem to allow conversion operators between derived types. The only other way I can see to do it is to have a method in DerivedFromA like this:-
public static DerivedFromA(A theInstance)
{}
which could then do the conversion. But that gives me access issues - i can't copy protected members from A to the new DerivedFromA instance.
Any ideas?
thanks
Jon
using System.Beer;
|
|
|
|
|
No, you can't cast an object to a class the inherits from the class of the object. You can only cast an object to any of it's base classes.
Jon Hulatt wrote: i can't copy protected members from A to the new DerivedFromA instance.
Yes, you can. You can access any protected members from the derived class. That is exactly what the protected keyword does, it allows access only from members of the class and from members of any derived classes.
---
b { font-weight: normal; }
|
|
|
|
|
Guffa wrote: Yes, you can. You can access any protected members from the derived class. That is exactly what the protected keyword does, it allows access only from members of the class and from members of any derived classes.
Not in the scenario I described above, you can't. Look at this example:-
class A
{
protected string astring = "hello world";
}
class B : A
{
public static B FromA(A ainstance)
{
string testing = ainstance.astring;
}
}
using System.Beer;
|
|
|
|
|
Oh, yes, that's right. The problem with accessing the protected property is that you are trying to access a propery of a different object.
You can get around this by sending the instance of the base class to a constructor of the base class. The base class can access the protected (or even private) properties of other objects of the same class:
class A {
protected string astring = "hello world";
public A(A ainstance) {
this.astring = ainstance.astring;
}
}
class B : A {
public B(A ainstance) : base(ainstance) {
}
}
---
b { font-weight: normal; }
|
|
|
|
|
Guffa wrote: No, you can't cast an object to a class the inherits from the class of the object. You can only cast an object to any of it's base classes.
Just wanted to mention that it is legal C#, only not a recommended practice. C# does allow casting down to the derived class.
Regards
Senthil
_____________________________
My Blog | My Articles | My Flickr | WinMacro
|
|
|
|
|
Hi All!
My MDI parent form creates a child form. Then I maximize it.
The icon of the child form appeares above main menu line. Not on the left of first item of menu.
How can I place child form icon and menu strip of the parent form in the same line?
Is it possible?
My application created in VS2005, C#, WinForms.
|
|
|
|
|
Are you using the Menustrip control that comes with .Net or a 3rd party menu control? I used MagicLibrary MenuCommand in one of my MDI apps which caused similar issue. I ended up using the standard menu bar.
- Malhar
|
|
|
|
|
malharone wrote: Are you using the Menustrip control that comes with .Net or a 3rd party menu control? I used MagicLibrary MenuCommand in one of my MDI apps which caused similar issue. I ended up using the standard menu bar.
Thank you!
|
|
|
|
|
Can any1 tell me where to get
PINVOKE.NET Add-In for Visual Studio
that would work with VS 2003 (DotNet FrameWork 1.1)...
o O º(`'·.,(`'·., ☆,.·''),.·'')º O o°
»·'"`»* *☆ t4ure4n ☆* *«·'"`«
°o O º(,.·''(,.·'' ☆`'·.,)`'·.,)º O o°
|
|
|
|
|
|
Hi every body how i can get data from SqlDataSource1 ?
|
|
|
|
|
here is one simple example
SqlDataSource1.ConnectionString = "your connection string";<br />
SqlDataSource1.SelectCommand = "select * from table";<br />
DataGridView1.DataSourceID = "SqlDataSource1";
|
|
|
|
|
I need just to take only one column how to do that
|
|
|
|
|
In property of GridView1 Edit columns uncheck AutoGenerate Fields add one DataBoundField.
in Property of BoundFields:
HeaderText - Displays text of column
SortExcpression - Here define Column for sorting Excpresion
DataField - Here define column for displaying data in GridView
SortExcpression and DataField must be same coumn otherwise u get error
|
|
|
|
|
No i need it to put it in array how i can get data like array??
|
|
|
|
|
I don't want to show this information i just need it to be push it in array is that possible and how?
|
|
|
|
|
Hi.
As most or all of you fine folks know many software companies license their products to a user for a certain time. Let´s say a user bought a program a year ago and it expired today. Then it stops working. How is this done? I also assume that this feature needs to work on computers that don´t have an internet connection.
Is there a thread in the program that checks to see if the time is such and such and then some features in the program are disabled?
Thanks for your help.
F
|
|
|
|
|
i think they write something hidden in the registry... notice that after reinstalling windows the blocade disappears. every time you launch the program it checks wheter trial period expires or not. that's it...
anyway i just guess... i don't know that for sure .
|
|
|
|
|
Almost every time I try to load my source safe bound solution containing a webservice project located on my local IIS I end up with a dialog box that says that the webservice project can't be found. No matter what you click or do you end up loading the solution without the webservice project.
The trick is that you have to remove the webproject from the loaded solution and then add it again, this way round it works.
The webservice project is located on the project directory structure, it's not under wwwroot...
did anybody face the same problem and found a solution to this anyoing problem?
myMsg.BehindDaKeys = "Jerry Maguire";
|
|
|
|
|
I have one of my c# applications coded using .net framework 1.1, which works fine.
Recently I installed Visual Studio 2005 - Professional edition on the same machine
(Arter formating and reinstalling Windows 2000 with SP4) and now the above application
takes a long time to open the connection to SQL Server 7.
My connection string is as follows
"user id=sa;password=;initial catalog=FINISHED_GOODS_STOCK;data source=naturubmain;Connect Timeout=30"
Once I try to open the connection it gave me 'Time out expired' error. I set the 'Connect Time out' to 0
just to find how long does it take to open the connection. It took above 1 minute and opend the
connection.
Pls help me. Withot fixing this I will not be able to enjoy the new features of VS2005
Thanx a lot
|
|
|
|
|
It might be a problem with name resolution in your network. Check what happens if you use the ip address of the server instead of the name.
---
b { font-weight: normal; }
|
|
|
|