|
|
Well, be more specific.
Which version of excel are you using? Is what you are doing a one-time deal, or do you need to do this repeatedly?Dalek Dave: There are many words that some find offensive, Homosexuality, Alcoholism, Religion, Visual Basic, Manchester United, Butter.
|
|
|
|
|
|
As you are using Excel 2003, and if you are doing this once, you can just save the spreadsheet as XML.
Otherwise you'll need to interop with excel to read the spreadhseet data, see http://support.microsoft.com/kb/302084[^] for more advice on how ti start this. You'll also find "Linq Xml" a usful term to google, for when you need to write te data out.Dalek Dave: There are many words that some find offensive, Homosexuality, Alcoholism, Religion, Visual Basic, Manchester United, Butter.
|
|
|
|
|
|
Hi ...first problem in C#
Basically I have a Base class and multiple derivs from Base.
All derivs are part of a Tree, so the mytree has somthing like CNode<CBase>
Now my question is is any way to make (force), override ToString() in my derivs class.
I will keep my all derivs class derived from Base.
so I can't use another abstract class and derive from this also.
I guess the only way is true by another interface, but how do I do this?
(if I put a simple interface and having func replaced with another func..mToString() -> this will be virtual in my Base and make derivs:INewInterface {string mToString()} doesn't work either because the compiller will consider having definition from Base )
thx
interface IBase
{
string ToString();
}
class CBase
{
public override string ToString()
{
return "Base";
}
}
class CDeriv1 : CBase, IBase
{
public override string ToString()
{
return "Deriv1";
}
}
class Program
{
static void Main(string[] args)
{
CBase nod = new Deriv1();
}
}
|
|
|
|
|
To do this (which isn't wise) need to create an abstract class:
abstract class CBase
{
public override abstract string ToString();
}
class CDeriv1 : CBase
{
public override string ToString()
{
return "Deriv1";
}
}
class Program
{
static void Main(string[] args)
{
CBase nod = new Deriv1();
}
}
But I think doing this to ToString() is a bad idea, you should either call your method something else, or just override the existing ToString() method.Dalek Dave: There are many words that some find offensive, Homosexuality, Alcoholism, Religion, Visual Basic, Manchester United, Butter.
|
|
|
|
|
You can mark the ToString method as abstract, however, a better design would be to mark it as virtual. I know the language. I've read a book. - _Madmatt
|
|
|
|
|
It is already declared as virtual in object , but it won't force an override as the OP requests.
I agree with your suggestion, that the OP should either use [the existing ToString() ] virtual method.
If it is strictly necessary to force derived classes to implement the method, abstract is needed, but it is better to use a different method so as not to conflict with object.ToString() .Dalek Dave: There are many words that some find offensive, Homosexuality, Alcoholism, Religion, Visual Basic, Manchester United, Butter.
|
|
|
|
|
Keith Barrow wrote: It is already declared as virtual in object,
That's true, I was thinking to add the new keyword to resolve the conflict, however, you're correct it won't force the override. I know the language. I've read a book. - _Madmatt
|
|
|
|
|
hi
First I need all my CDeriv.. clasees to be derived from Base. I have to convert these classes to Base and put them in a tree.
So CDeriv class has a base: CBase class non - abstract.
class CBase //this on is NON abstract - i need intances for my Tree
{
public virtual string mToString(); // don't intend necessarly to force override Object.ToString(), i just need a virtual here
}
class CDeriv1 : CBase
{
public override string mToString()
{
return "Deriv1";
}
}
now having this I would like to force in CDeriv1 mToString to be overriden..by an interface? because to derive from an abstract I can't. I allready have one base class
|
|
|
|
|
The only way c# will force you to override is by declaring a method as abstract . To do this, the class itself must be abstract, what you ask for is impossible without an abstract base class.
The base class can still have implementations of methods etc, so you can form your tree, you can also cast to an abstract class e.g. this is valid:
CDeriv1 foo = new CDeriv1();
CBase myInstance = foo;
Even if CBase is abstract So you can have a List<CBase> etc as a property to form the tree. Try making your current base class abstract and see what happens!Dalek Dave: There are many words that some find offensive, Homosexuality, Alcoholism, Religion, Visual Basic, Manchester United, Butter.
|
|
|
|
|
ok, thanks
I didn't know I can cast to a object from an abstract class.
Thanks again
|
|
|
|
|
hmmm...in fact that is not an object of an abstract class.
Is my CDeriv object which is casted.
???
|
|
|
|
|
Other than using abstract, the base class should not know or care about what any derived classes do.
But... you could probably have the base class throw an Exception, or maybe mark it as Obsolete.
|
|
|
|
|
Hi Team,
Required functionality is to get the return week number of a given date.
Supposed
8th march 2010 is the given date then it should return "2" as 2nd week.I have implemented a below method which return week number of the year, whereas requirement is return week no of the current month.
Could any body help me out from this scenario.
public static int GetWeekNumber(DateTime dtPassed)
{
CultureInfo ciCurr = CultureInfo.CurrentCulture;
int weekNum = ciCurr.Calendar.GetWeekOfYear(dtPassed, CalendarWeekRule.FirstFourDayWeek , DayOfWeek.Monday);
return weekNum;
}
Tarun Singh.
Thanks in Advance.Regards
Tarun Singh
Sr. Software Engineer.
mailto:tksingh@zenta.com
|
|
|
|
|
If your looking for how many weeks have passed in the month that a date is in you can use this.
static int weekNum1(DateTime T)
{
return 1 + (int)T.Day / 7;
}
or if your looking for how many business weeks (ie weeks starting on sunday) you can use this
static int weekNum2(DateTime T)
{
int weekNum = 1;
DateTime w = new DateTime(T.Year, T.Month, 2);
while (w <= T)
{
if (w.DayOfWeek == DayOfWeek.Sunday)
weekNum++;
w = w.AddDays(1.0);
}
return weekNum;
}
|
|
|
|
|
Please don't cross-post[^] your questions. Kristian Sixhoej
"You can always become better." - Tiger Woods
|
|
|
|
|
Hello,
I have build a windows service that I wan't to deploy on another operating system.
The service is build in C# .NET 3.5 on a Windows XP Pro PC.
I wan't to deploy the service to another maschine that has the same operating system.
For that I have created an Installer class in my service project and also I have build a setup project that includes the service project.
When I move the executable code to the target maschine and run the setup everything seems to go well. But I cannot se the service?! I don't wan't to use the installutil feature.
Everything is programmed in Visual Studio 2008.
What can be wrong?
Do I have to use the installutil and how can I automitacally call that feature så that the service will be installed properly. I also wan't my service to be started automatically.
My customer is not used with this type of applications therefore I wan't everything to be done automatically.
Best regards
|
|
|
|
|
Message Closed
modified 23-Nov-14 6:37am.
|
|
|
|
|
Well, I have built my deployment project from that Web page ( )
It doesn't work!
|
|
|
|
|
Message Closed
modified 23-Nov-14 6:37am.
|
|
|
|
|
My solution in Visual Studio consists of several projects.
1. One DLL project which holds the business code
2. One project that is the service - reference is made to previous project
3. One Console project used to force a execution without the service - reference is made to first project (DLL project)
4. Setup deployment project - reference is made to the service
|
|
|
|
|
In C# web application Requirement is when using admin panel admin inserts categoy,product etc then update also his store database on Ebay i hv integrated site with Ebay store db and updating that too. But Saving data takes time and Admin gets logout automatically I think default session time is up Plz help how to handle this
|
|
|
|
|
Not necessary that Session has timed out. It could be databse transaction timeout too. Or the established Connection timeout. You need to debug and find where the bottle neck is and increase the time accordingly.
|
|
|
|