|
Hi
I am builduing a project in c# and vs .net 2003. I want a custom trackbar control with an appearance I want. I can show the snapshot, but i do not know how to upload it here?Please help.
|
|
|
|
|
Upload your snapshot to something like flickr or some free webhost account, then post the link to the snapshot.
"Real programmers just throw a bunch of 1s and 0s at the computer to see what sticks" - Pete O'Hanlon
|
|
|
|
|
i have two interfaces i1 and i2;
both of them have got a function with the same name
i1- function_some();
i2- function_some();
now i am gonna implement both the interfaces to a class
how do i define the functions after implementing....
of i1 and i2 respectively
thanks bye
|
|
|
|
|
You will scope them explicitly.
void i1.function_some()
{
// body
}
void i2.function_some()
{
// body
}
Now, if you try to call function_some on your class instance, you'll get an error, you'll need to scope it there, too, I am not sure if there's a way to do this, apart from casting to the right interface.
Christian Graus - Microsoft MVP - C++
"I am working on a project that will convert a FORTRAN code to corresponding C++ code.I am not aware of FORTRAN syntax" ( spotted in the C++/CLI forum )
|
|
|
|
|
class c
{
void i1.function_some()
{
// body
}
void i2.function_some()
{
// body
}
}
class c1:c
{
c dd =new c();
dd.//how do i call particular funcion
}
if i inherit the class where i implemented how do i call these
in the inherited class
|
|
|
|
|
As already mentioned - cast it to the correct interface:
((i2)dd).function_some()
If you need to do this your OO design is most likely wrong though.
|
|
|
|
|
thnx
i have used things in the similar manner
but it didnt strike me
thanx
|
|
|
|
|
Christian Graus wrote: You will scope them explicitly.
Not necessarily:
interface I1
{
void TheMethod();
}
interface I2
{
void TheMethod();
}
class C : I1, I2
{
public void TheMethod()
{
Console.WriteLine("Did you ask for me?");
}
}
public static int Main(string[] args)
{
C c = new C();
I1 i1 = new C();
I2 i2 = new C();
c.TheMethod();
i1.TheMethod();
i2.TheMethod();
return 0;
} However, I agree that it's bad design.
Cheers,
Vıkram.
After all is said and done, much is said and little is done.
|
|
|
|
|
Right, if the contracts of both interfaces can be satisfied with one method, then things are simple. Until I read this thread I didn't know any other way existed.
A class that implements more than one interface may need to provide a separate implementation for each.
|
|
|
|
|
string = "www.abc.com?page=123&no=456";
if I want to cut the "page=123", how to do it?
I would like to use System.Text.RegularExpressions.Regex.
finally string = "www.abc.com?no=456";
THANKS
|
|
|
|
|
Do u need Regular Expression for this Format?
|
|
|
|
|
any method, which can do the same thing, is OK.
|
|
|
|
|
|
mimimimilaw wrote: if I want to cut the "page=123", how to do it?
string str = "www.abc.com?page=123&no=456";<br />
str = str.Replace("page=123&","");<br />
MessageBox.Show (str);
Thanks and Regards,
Michael Sync ( Blog: http://michaelsync.net)
If you want to thank me for my help, please vote my message by clicking one of numbers beside "Rate this message". Why vote? Plz Read it here. Thank you.
|
|
|
|
|
This works only if page is always 123, which is probably not the case.
Try this instead:
Regex.Replace("www.abc.com?page=123&no=456", @"(?<urlstart>.*\?)page=\d+&(?<urlend>.*)", @"${urlstart}${urlend}")
-----
If atheism is a religion, then not collecting stamps is a hobby. -- Unknown
God is the only being who, to rule, does not need to exist. -- Charles Baudelaire
|
|
|
|
|
I know.. but he doesn't ask for it..
anyway, thanks for your code..
Thanks and Regards,
Michael Sync ( Blog: http://michaelsync.net)
If you want to thank me for my help, please vote my message by clicking one of numbers beside "Rate this message". Why vote? Plz Read it here. Thank you.
|
|
|
|
|
Try using the Uri class. You would probably want to do something like
Uri builder = new Uri("www.abc.com?page=123&no=456");
string[] parts = builder.Query.Split('&');
string final = String.Format("{0}?{1}", builder.AbsolutePath, parts[2]);
|
|
|
|
|
Could anyone please help me out in auto-generating a property in a class in a following format:
public System.Int64 RollNumber
{
get
{
System.Int64 rollNo = (System.Int64 )this["@roll_number"];
return rollNo;
}
}
I am able to generate the property with the return statement and the other stuff, but i am not able to Generate the assignment statement i,e :
System.Int64 rollNo = (System.Int64 )this["@roll_number"];
Please Help.
Thanks,
Ramesh
|
|
|
|
|
rameshbhojan wrote: auto-generating
?
Did you mean this?
public System.Int64 RollNumber
{
get
{
System.Int64 rollNo = (System.Int64 )this["@roll_number"];
return rollNo;
}
set
{
this["@roll_number"] = (proper_cast)value;
}
}
Greetings - Gajatko
|
|
|
|
|
Hi Gajatko,
All i wanna generate is :
public System.Int64 RollNumber
{
get
{
System.Int64 rollNo = (System.Int64 )this["@roll_number"];
return rollNo;
}
}
i don need the set statement....
anyways gimme the solution you have...... if i am able to generate the way you said then also it is fine!!!!
Thanks,
Ramesh
|
|
|
|
|
The class your looking for is CodeVariableDeclarationStatement.
CodeMemberProperty prop = new CodeMemberProperty();
prop.Name = "RollNumber";
prop.HasGet = true;
prop.Attributes = MemberAttributes.Public;
prop.Type = new CodeTypeReference("System.Int64");
prop.GetStatements.Add(new CodeVariableDeclarationStatement("System.Int64", "rollNo",
new CodeCastExpression("System.Int64",
new CodeIndexerExpression(
new CodeThisReferenceExpression(),
new CodePrimitiveExpression(
"@roll_number")))));
prop.GetStatements.Add(new CodeMethodReturnStatement(new CodeVariableReferenceExpression("rollNo")));
But why bother with the variable when you could just return (System.Int64 )this["@roll_number"];
|
|
|
|
|
Hi All,
I have used CodeDOM in .net to auto-generate C# code, which in essence generates a class file having a class along with its member fields, methods and properties.
However, i don know how to generate the following line of code:
private const string NAME = "CSharp";
Here, i have a generate a CodeMemberField which is a constant string with a private specifier as shown above.
Please send me the sample code which would help me to auto-generate the above line of code.
Thanks,
Ramesh
|
|
|
|
|
How do you auto-generate c# code? You can build your code from strings and then compile it into dll file or executable dynamically during runtime
|
|
|
|
|
ya .... tats wat i meant Giorgi....
as u mentioned i can build the code from string...
in the content of tat string i want one such statement which i mentioned in my query above........
do u know how to do tat??????
Thanks,
ramesh
|
|
|
|
|
So it means that you need help in string manipulation? You need string which says private const string NAME = "CSharp"; ? I guess your problem is having " inside you string isn't it?
|
|
|
|