|
Im not very sure about real code for you now, but i suggest you should take a look into Regualar Expressions. Regular expressions let you identify portions of strings, characters or even patterns of strings in given source strings (e.g. tag-like structures). You can even replace strings of an expressed pattern in a given source string.
.Net supports Regular Expressions since the earliest versions. I guess it will suffice. Ask Mr. Google about examples of regular expressions...
Sory bro, that I cannot give you any real code. However, i hope my answer leads you to a solutions.
Best regards
Trollpower
|
|
|
|
|
Yeah.. I know regex's (I've been writing PHP's for years now ).
Just don't know how to do it in C#, I would do it like this in PHP:
preg_match_all("#<? (.*?) ?>#si",$content,$matched);
modified on Friday, December 19, 2008 8:44 AM
|
|
|
|
|
The MSDN website has a good explanation of the regular expression capabilities in .NET. [^]
99% of what you know will transfer from PHP. The most obvious differences are that you do not start and end the pattern with a delimiter character and that you specify expression options (like the si at the end of your expression) differently. There are also some advanced things you can do with .NET regular expressions, but you probably will not need them here.
As for looping through the matches, you will probably use a while loop
using System.Text.RegularExpressions;
string phpFileText = ;
Regex matcher = new Regex(,
);
Match code = matcher.Match(phpFileText);
while (code.Success)
{
code = code.NextMatch();
}
PS: don't forget that ? is a quantifier in regular expressions, so you need to escape them when searching for a literal ?
|
|
|
|
|
I want to find column index of particular column in DataGrid by just passing column value.Is it possible.
If anyone knows please reply,
Thanks.
|
|
|
|
|
Yes, but what happens if more than 1 column or row contains the value? You can find the column index by iterating throught he ciolumns and rows.
Bob
Ashfield Consultants Ltd
|
|
|
|
|
hello all
I have an application in c#. which i want make in as a plugin .... to eclipse
is this posiible ?
if so how ?
kindly plz provide me with some suggestions
Thanks
TJS
|
|
|
|
|
I expect the best place to start would be the eclipse web site or their tech support to see how you define a plugin to their app.
Bob
Ashfield Consultants Ltd
|
|
|
|
|
I've object and it has a lot of objects
When I access Childobjects everything is ok but not MemoryStreams;
public class myObject
{
public List<ChildObject> subObject = new List<ChildObject> { };
public string ObjectName { get; set; }
public class ChildObject
{
public string ChildObjectName { get; set; }
public MemoryStream ChildStream { get; set; }
}
}
When I use this object I am using following code;
MemoryStream myMS = new MemoryStream();
myMS.Position = 0;
myObject MyObj = new myObject();
MyObj.ObjectName = "My First Object";
MyObj.subObject.Add(new myObject.ChildObject());
MyObj.subObject[0].ChildObjectName = "My First Sub Object";
MyObj.subObject[0].ChildStream.Position = 0;
Thanks for your reply.
|
|
|
|
|
Indeed - you've not provided the error message you're getting.
Hold on though - I'll use my psychic powers.....
"Object reference not set to an instance of an object"
ChildStream has not been instantiated.
MyObj.subObject[0].ChildObjectName = "My First Sub Object";
MyObj.subObject[0].ChildStream = new MemoryStream()
MyObj.subObject[0].ChildStream.Position = 0;
|
|
|
|
|
Impressive
Is it possible to auto create this MemoryStream in my subClass's constructor?
When I Create following...
MyObj.subObject.Add(new myObject.ChildObject());
I want to use this MemoryStream directly.
Thanks
|
|
|
|
|
Sure, just add a constructor to ChildObject and instantiate the memoryStream therein.
|
|
|
|
|
Thanks for your help. This is work for me.
Final solution as like these;
public class myObject
{
public List<ChildObject> subObject = new List<ChildObject> { };
public string ObjectName { get; set; }
public class ChildObject
{
public string ChildObjectName { get; set; }
public MemoryStream ChildStream { get; set; }
public ChildObject()
{
ChildStream = new MemoryStream();
}
~ChildObject()
{
ChildStream.Dispose();
}
}
}
|
|
|
|
|
You may also want/need to implement IDisposable on your class to
have more control over the lifetime of that stream (and it's
associated memory).
Mark
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
I've got a large class in c++. I couldn't convert to C#.Because i don't know a lot of construction and contents in this class. I want to import this class to c# app. Can my problem solve in C#. How do I import c++ class to C#.
I hope I can communicate my problem more rihgt.
thanks
|
|
|
|
|
You have two choices, either put it in a dll, and import the functions like you would with any other dll, or make a managed c++ wrapper around your class that converts the managed types to unmanaged, and vice versa.
|
|
|
|
|
I am getting this error...
Unable to cast object of type 'System.Web.UI.WebControls.LinkButton' to type 'System.Web.UI.WebControls.Button'
how i solve this problem..
Thanks.
|
|
|
|
|
Why are you trying to do that?
The best way to accelerate a Macintosh is at 9.8m/sec² - Marcus Dolengo
|
|
|
|
|
i am getting error in this foreach loop...
ButtonList contains List of Buttons and LinkButtons.
foreach (Button str in ButtonList)
{
}
|
|
|
|
|
I just took a sleeping pill and can't think clearly, but this could work.
foreach(Control ctrl in ButtonList)
{
if(ctrl is Button)
{
Button myButton = (Button)ctrl;
//Do work
}
else if(ctrl is LinkButton)
{
LinkButton myLinkButton = (LinkButton)ctrl;
//Do work
}
}
Ask others first since I am way over due for sleep, and good night. That 'should' work though.
The best way to accelerate a Macintosh is at 9.8m/sec² - Marcus Dolengo
|
|
|
|
|
LinkButton, Button and ImageButton dont have a shared base class, but they do have an interface which they all implement called IButtonControl . So this will work for you (asuming that IButtonControl has the property/method you are trying to use)
foreach(IButtonControl btn in ButtonList
{
...
}
|
|
|
|
|
hai sir/mam
how to merge two individual picture into a single picture box
and back image is remain constant but the fore imageis transparent and to visible two picture givean example code also
ok bye sir/mam
|
|
|
|
|
This forum is not the place to just get code handed to you. You must try, think, fail, then come and ask for help. Post what you have so far, and we will be glad to help you get past an error or two.
The best way to accelerate a Macintosh is at 9.8m/sec² - Marcus Dolengo
|
|
|
|
|
As others said, you have to write your own code. As a pointer, a picturebox is not a magic image processing library. It's a tool for people who are too inexperienced to know how to paint an image onto a form ( although that's not too hard ). You'll have to write code for all of this, and the picture box will just get in the way.
Christian Graus
Driven to the arms of OSX by Vista.
|
|
|
|
|
OMG! How did you even figure out what he wanted?
"Why don't you tie a kerosene-soaked rag around your ankles so the ants won't climb up and eat your candy ass..." - Dale Earnhardt, 1997 ----- "...the staggering layers of obscenity in your statement make it a work of art on so many levels." - Jason Jystad, 10/26/2001
|
|
|
|
|
Hi all,
how we can read/write data from powerpoint presentation using c# .net.
plz replay if any method for this query..
Thank you.
|
|
|
|