Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
VFP Toolkit for .NET
Message
From
16/10/2009 00:00:42
 
 
To
12/10/2009 12:29:19
General information
Forum:
ASP.NET
Category:
Other
Environment versions
Database:
Visual FoxPro
Miscellaneous
Thread ID:
01428975
Message ID:
01429587
Views:
249
>Has anyone actually used this function toolkit in a .NET app? Did this library ever catch on in the .Net world?
>
>http://foxcentral.net/microsoft/VFPToolkitNET.htm
>
>I'm just wondering if it is a good idea to use something like this in .Net, or if there are other more commonly used libraries to add string handling functionality to .Net apps.
>
>Would other devs see this as some weakness to hang on to a bunch of VFP methods, or would it be some great tool that even non-VFP'ers would use.

Matt

Replying to your original post since this thread has changed its tack as usual to something different.

While the toolkit was introduced to get people to learn .NET, there are certain functions you may be used to in VFP which are oneliners which you would have to re write in .Net. (or at least this was the situation with VS2005)

For instance while the string functions in .NET are numerous and powerful, I was unable to find one that I could use as a substitute for the powerful VFP STREXTRACT(), without writing my own.

So I used the toolkit instead and called its STREXTRACT() and it worked fine. For me that was just one line of code as opposed to many more.

The toolkit help file shows the VB and C# code that is used to create these functions. So as you can see this is what I would have had to write myself to get the similar functionality:
[C#]
public static string StrExtract(string cSearchExpression, string cBeginDelim, string cEndDelim, int nBeginOccurence, int nFlags)
{	
	string cstring = cSearchExpression;	
	string cb = cBeginDelim;	
	string ce = cEndDelim;	
	string lcRetVal = "";	

	//Check for case-sensitive or insensitive search	
	if (nFlags == 1)	
	{		
		cstring = cstring.ToLower();		
		cb = cb.ToLower();		
		ce = ce.ToLower();	
	}	
	//Lookup the position in the string	
    int nbpos = At(cb, cstring, nBeginOccurence) + cb.Length - 1;
	int nepos = cstring.IndexOf(ce, nbpos + 1);
	//Extract the part of the strign if we get it right	if (nepos > nbpos)	
	{
		lcRetVal = cSearchExpression.Substring(nbpos , nepos - nbpos);
	}	
	return lcRetVal;
}
public static string StrExtract(string cSearchExpression, string cBeginDelim)
{
	int nbpos = At(cBeginDelim, cSearchExpression);
	return cSearchExpression.Substring(nbpos + cBeginDelim.Length - 1);
}

public static string StrExtract(string cSearchExpression, string cBeginDelim, string cEndDelim)
{	
	return StrExtract(cSearchExpression, cBeginDelim, cEndDelim, 1, 0);
}

public static string StrExtract(string cSearchExpression, string cBeginDelim, string cEndDelim, int nBeginOccurence)
{	
	return StrExtract(cSearchExpression, cBeginDelim, cEndDelim, nBeginOccurence, 0);
I don't know whether they have added any functions since VS2005 into .NET but for me I had a job to do not spend my time working out all the extra code. So I used the toolkit. So if you find you are having to resort to typing in multiple lines of code and build your own missing functions, then why not use the pre built functions already in the toolkit. This function alone is a ratio of 30 lines to 0.

After all most .Net developers use other people's code and components anyway. Why re invent the wheel under the guise of learning? Of course with the time you have saved using the toolkit, you could research more and learn more or even read the help file and see how the function is written.

Bernard
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform