|
|
You should try to avoid using functions from the VisualBasic namespace.
|
|
|
|
|
Le Centriste wrote: You should try to avoid using functions from the VisualBasic namespace.
So why do you say that? Is that namespace inferior?
|
|
|
|
|
This package is used to support the VisualBasic runtime.
|
|
|
|
|
Yes I know that, but what is wrong with it? Why should you not use it?
|
|
|
|
|
Because there are better alternatives in the .NET library. Furthermore, they are legacy.
We had a guy here who was using the CInt function to simply convert a string into an integer (he was using VB.NET and was a former VB programmer). His algorithm seemed to be working well but the numbers were not right. I suggested that he uses Int32.Parse instead, just for the heck of it. Coincidentally, Int32.Parse threw an exception instead of converting the number. It turned out the string was not a number, but the scientific representation of a number. CInt was making the best of it by taking the interger part of the number, which was wrong in this case.
The reason why Microsoft created VB.NET and added support for the VB runtime is because they wanted to lure VB programmers and make them embrace the .NET platform.
|
|
|
|
|
It wouldn't have been CInt since CInt isn't a function - it's a 'macro' built into the VB language. You couldn't use it from C# even if you wanted it. Same goes for CType, CDbl, CStr, DirectCast, etc.
David Anton
http://www.tangiblesoftwaresolutions.com
C++ to C# Converter
C++ to VB Converter
C++ to Java Converter
VB & C# to Java Converter
Java to VB & C# Converter
Instant C#: VB to C# converter
Instant VB: C# to VB converter
Instant C++: convert VB, C#, or Java to C++/CLI
|
|
|
|
|
You are right, the guy was using VB.NET, I forgot to mention. But what I said is still valid, even with VB.NET.
|
|
|
|
|
In fact, I re-read my post and I actually mentioned the guy was using VB.NET.
|
|
|
|
|
Sorry - I should have read the post more carefully.
David Anton
http://www.tangiblesoftwaresolutions.com
C++ to C# Converter
C++ to VB Converter
C++ to Java Converter
VB & C# to Java Converter
Java to VB & C# Converter
Instant C#: VB to C# converter
Instant VB: C# to VB converter
Instant C++: convert VB, C#, or Java to C++/CLI
|
|
|
|
|
|
Use int.TryParse() method.
string str = "123";
nt num;
if( int.TryParse( str, out num))
{
}
|
|
|
|
|
I think Regex would be the way to go:
return Regex.IsMatch(yourText, "^\d+$");
This would work for simple numbers.
|
|
|
|
|
I am creating a 5 star rating control. For this I have created a user control with the Callback functionality. When I implement the usercontrol on an aspx page, I want that the label control to populate the value of the image that was clicked. But, when I debug my application, it shows that the label control has the value and it does not show on the page. Following is the code I am using for the User Control:
public event System.Web.UI.WebControls.CommandEventHandler Rater;
protected void Page_Load(object sender, EventArgs e)
{
sCallBackFunctionInvocation = Page.ClientScript.GetCallbackEventReference(this, "message", "ShowSuccess",
"context");
String callbackScript;
callbackScript = "function CallServer(message, context)" +
"{ " + sCallBackFunctionInvocation + ";}";
Page.ClientScript.RegisterClientScriptBlock(this.GetType(),
"CallServer", callbackScript, true);
}
public void RaiseCallbackEvent(string eventArgument)
{
if (hdn.Value.ToString() == "" && (eventArgument == "0" || eventArgument == string.Empty))
{
returnValue = "0";
totChecked = returnValue;
hdn.Value = returnValue;
}
else
{
returnValue = eventArgument;
hdn.Value = returnValue;
totChecked = returnValue;
CommandEventArgs args = new CommandEventArgs("Rated", hdn.Value.ToString());
Rater(this, args);
}
}
public string GetCallbackResult()
{
return returnValue;
}
The following code is used for aspx page
protected void Page_Load(object sender, EventArgs e)
{
rc1.Rater += new CommandEventHandler(rc_Rater);
}
private void rc_Rater(object sender, CommandEventArgs e)
{
RatingControl rc = new RatingControl();
lbl.Text = e.CommandArgument.ToString();
}
-----Have A Nice Day-----
|
|
|
|
|
Probably best to ask this in the ASP[^] forum.
Simon
|
|
|
|
|
Hello,
I'm using the web browser control to read html files but I want to get the source code of these files but I can't?
Thanks
Dad
|
|
|
|
|
do u want html code of these files??
then it is possible without Web Browser CONTROL
|
|
|
|
|
Hi,
I have developed a windows sservice on my dev machine.
The project installer is also created.
This service is tested on my machine and it is fine.
Now I would like to give it to the management to install/run it on the required machine.
Question:
How should this windows service application be setup on the requred machine which may or may not have .net framework?
Thanks
|
|
|
|
|
if(!TargetMachineHasDotNetFramework)
{
InstallRequiredDotNetFramework();
}
InstallWindowsService();
well, you did ask in the C# forum.
|
|
|
|
|
I think you mis-understood.
I would like to know how to install the windows service on another machine? I mean do I just copy the whole development codes to the other machine, etc?
Thanks
|
|
|
|
|
You said you had an installer for your service, wouldn't logic tell you to install your service you would use the installer?
|
|
|
|
|
On my machine which has visual studio, I run the vs command to install or un-install the service.
The question is:
What do I do if this service needs to be installed on another machine? If the installer is required for this purpose, then how do I run it on another machine. I believe I can not get vs command on the other machine.
Hope you follow my question.
Thanks
|
|
|
|
|
arkiboys wrote: What do I do if this service needs to be installed on another machine
Easiest way is to create an installer, take that installer to the other machine and run it.
A Google search[^] will provide you with a plethora of information on the subject.
|
|
|
|
|
To install the Windows Service on another machine you would add a
Setup project to your solution which would then create an MSI package.
Run the MSI package on the target machine and this will create the Windows Service.
Obviously you would need the relevant .NET Framework version on the target machine.
|
|
|
|
|
Can I do this by the click once method to install the service on another machine?
Thanks
|
|
|
|