|
I wrote this code once, I just checked the code of every new entered char, if it is bigger that the char code for '9' or smaller than the char code '0', than its not a number (I'm not sure that 9 is the biggest char).
|
|
|
|
|
mostafa_h wrote: but I can enter "5.5" or "6/8" in the TextBox .
how can it possible that the user enter "ONLY Number " in textbox.
You are parsing the string to a double, so why shouldn't you be able to enter 5.5? It is a double!
If you want only integers then use int.Parse.
Otherwise you can check each character entered as the other poster has proposed. Use Char.IsDigit to determine if it is a valid digit and reject anything else. But consider whether you need to support negative numbers as well. In that case you need to check for - as well.
|
|
|
|
|
thanks for your reply !
but , the result of int32.Pars(.....) is not a boolean .
regards !
s_mostafa_h
|
|
|
|
|
|
dan neely wrote: int32.TryParse(...)
ARE YOU SURE !
Int32 , has not "TryPars" method .
s_mostafa_h
|
|
|
|
|
It doesn't need to return a boolean. If it fails it will throw an exception which you are trapping already in your code.
In fact the trapping you were using with double.TryParse should be unneccessary because I don't think you can make TryParse throw an exception (it returns false instead).
|
|
|
|
|
Hi,
I am using CSharpCodeProvider for the first time (.NET 1.1 & VS2003). My application has been used without problems for a few weeks.
Now I started using an external assembly (PortController.NET) from the generated assembly.
I can access the generated assembly (create objects and call methods) but when it reaches the poing where it uses PortController.NET (creating new object) I get the exception:
File or assembly name PortController.NET, or one of its dependencies, was not found.
But it works when executed through the debugger!?
My code looks like this:
ICodeCompiler comp = (new CSharpCodeProvider().CreateCompiler());<br />
CompilerParameters cp = new CompilerParameters();<br />
cp.ReferencedAssemblies.Add("system.dll");<br />
cp.ReferencedAssemblies.Add(@"C:\Program Files\PortController.NET\PortController.NET.dll");<br />
cp.GenerateExecutable = false;<br />
cp.GenerateInMemory = true;<br />
<br />
CompilerResults cr = comp.CompileAssemblyFromFile(cp, filepath);
In VS2003 PortController.NET is listed in the .NET list (for adding references) so I guess it's in the GAC.
Any suggestions?
Thanks,
Jan
|
|
|
|
|
Hi,
The problem is probably with Fusion ( the system responsible for loading assemblies ).
You cannot load an assembly that lives outside the .exe directory structure.
So either make sure the PortController.NET.dll assembly is in the GAC, or just put it in the same directory as your .exe. Either way, remove the path from the call to ReferencedAssemblies.Add .
If this doesn't work you will have to use Fuslogvw.exe to check the fusion logs. I seem to remember you have to clear your temporary internet files first.
You used to be able to view the GAC using Explorer ( at C:\Windows\assembly ), but I just checked my system and it seems to have disappeared
----------------------------
Be excellent to each other
|
|
|
|
|
Thanks for a very fine and serious answer. 5 from here.
I can't wait to get back to work monday.
Cheers
|
|
|
|
|
Hi all,
I wonder if i can program in c# only so the framework enviournment will net be needed on deployment ?
what if i have made a .NET package with forms/API/system tray and now i dont want the .net thing? can i use the code to be compiled in a non framework enviournment?
Thanks,
Ran.
R.Z
|
|
|
|
|
ranzask wrote: I wonder if i can program in c# only so the framework enviournment will net be needed on deployment ?
It will be needed, always.
ranzask wrote: can i use the code to be compiled in a non framework enviournment?
No, sorry. But you can write your own compiler and class library. It would be great!
C# is a standard ECMA language, but all the available compilers (Microsoft and Mono) require a specific framework.
___________________________________
Tozzi is right: Gaia is getting rid of us.
My Blog [ITA]
|
|
|
|
|
I hope I understood you rightfully.
C# only exists for .NET (as I know). If you use C# you use .NET. If you don't want to use .NET you have to use another language (like C++). You can compile a C# Programm for other plattforms (Linux, Mac OS) but you use .NET.
Greetings,
Ingo
------------------------------
A bug in a Microsoft Product? No! It's not a bug it's an undocumented feature!
|
|
|
|
|
There are *expensive* 3rd party tools that can create a standalone executable by statically linking the needed parts of the framework into your app, there isn't a provided way to do so.
|
|
|
|
|
You're a little wrong.
C# is a (standard) language, so *theoretically* it can be compiled to any platform. You only need a compiler.
The problem is that all the real-world implementations of a C# compilers require the .NET Framework (csc.exe or the Borland something.net) or the Mono Framework (Mono compiler).
The 2 frameworks' BCL are not equal: many classes haven't the same name and/or aren't in the same namespace, so the same code won't compile on the 2 frameworks.
___________________________________
Tozzi is right: Gaia is getting rid of us.
My Blog [ITA]
|
|
|
|
|
Hi all,
Because my internet connection is through proxy server so that I can't use the TcpClient to connect to the peer who is outsite from my network. Are there any solution to solve this problem ?
Thanks,
Ken
|
|
|
|
|
Hi,
If your network only allows http through a proxy server, then the answer is no.
You need to get your Network Admin to set up NAT on your router.
----------------------------
Be excellent to each other
|
|
|
|
|
Hello kendao,
It is not metter that you are through proxy or not. But it is metter that a peer has a real IP. Means peer is not inside proxy.
I hope you understand what i want to say.
And still there is another problem then i am sorry.
Regards,
Divyang Mithaiwala
|
|
|
|
|
I'm building an application and I'm trying to use my own class which adds a bit extra information to a TreeNode. But even though I override ToString() when they are rendered by the TreeView they seem to use the standard TreeNode.ToString(). I'm guessing this is because when the TreeView iterates the Nodes it contains it treats them as TreeNodes. That would make sense. So the question is what is there a way to override TreeNode.ToString() or get the TreeView to treat the objects as MyTreeNodes rather than ordinary ones.
|
|
|
|
|
Hi!
I guess you'd have to override the Text property of TreeNode, not the ToString() method.
Regards,
mav
--
Black holes are the places where god divided by 0...
|
|
|
|
|
Hi,
Mav is right - you need the Text property, but it is not declared as virtual so you cannot override it.
The displayed text can be set by using one of the constructors that takes a string, or you can set the value of the Text property directly. The TreeView just displays this value.
----------------------------
Be excellent to each other
|
|
|
|
|
Thanks guys...
Because i need my text to be somewhat dynamic I have done a RefreshText() method which will update the Nodes Text property to what it needs to be. I hoped there was a more elegant solution but it appears not.
Just means if I add a node I have to go down the tree and refresh all the nodes.. It seems to work.
Thanks for your help I'm still trying to get my head around virtual override new and derivation of classes and stuff.
|
|
|
|
|
Hello,
Had anyone tried to use TB_CUSTOMIZE message with WinForm toolbars. I have used SendMessage to display toolbar customization window but it just didn't help. Any suggestion/links will be appretiated.
Thanks in advance.
Maqsood Ahmed - MCAD.net
Kolachi Advanced Technologies
http://www.kolachi.net
|
|
|
|
|
I developed a LDAP concept in C#, Having Groups combo, under every group nearly 3,000 users are there. Under Groups combo selectedindexchange() event I am filling Users combo(having 3,000 users nearly). For filling it is taking nearly 2min. In between if we select another group, Blank screen is coming. That is system is hanged and performance is very slow. To increase its performace i want to use cache concept. For that I want to store users under particular group in cache, when the second time same Group combo is selected It should come from cache but not from LDAP server.
How to develope it? Any body help me...it is very urgent to my client....My code is:
private void cboGroups_SelectedIndexChanged(object sender, System.EventArgs e)
{
cboUsers.Items.Clear();
Response.Flush();
try
{
LoadUsers("LS1");
}
catch(Exception ex)
{
if(ex.Message=="The server is not operational")
{
try
{
LoadUsers("LS2");
}
catch(Exception ex1)
{
if(ex1.Message=="The server is not operational")
RegisterStartupScript("script","alert('LDAP Server seems to be down, please contact City Insight administrator.');");
else
throw new Exception(ex1.Message);
}
}
else
throw new Exception(ex.Message);
}
}
private void LoadUsers(string ldapServerID)
{
string IPassAddress,IPassUsername,IPassPassword;
if(ldapServerID=="LS1")
{
IPassAddress=ConfigurationSettings.AppSettings["IPassAddress"].ToString();
IPassUsername=ConfigurationSettings.AppSettings["IPassUsername"].ToString();
IPassPassword=ConfigurationSettings.AppSettings["IPassPassword"].ToString();
}
else
{
IPassAddress=ConfigurationSettings.AppSettings["AltIPassAddress"].ToString();
IPassUsername=ConfigurationSettings.AppSettings["AltIPassUsername"].ToString();
IPassPassword=ConfigurationSettings.AppSettings["AltIPassPassword"].ToString();
}
cboUsers.Items.Clear();
if(cboGroups.Items.Count >0)
{
string ou=Session["ou"].ToString();
//string AdsiPath="LDAP://211.114.211.31/l="+cboGroups.SelectedItem.Text+",ou="+ou+",o=Managed iPass,dc=sc-m.net";
string AdsiPath=cboGroups.SelectedValue.ToString();
DirectoryEntry de = new DirectoryEntry(AdsiPath);
//de.Username="cn=LDAP";
//de.Password="LTDldn51";
de.Username=IPassUsername;
de.Password=IPassPassword;
DataSet ds=new DataSet();
DataTable newTbl=new DataTable();
DataColumn dc1=new DataColumn();
newTbl.Columns.Add("uid");
newTbl.Columns.Add("path");
ds.Tables.Add(newTbl);
foreach (DirectoryEntry ce in de.Children)
{
// //if(ce.SchemaClassName.Equals("inetOrgPerson"))
// //{
// ListItem newItemList = new ListItem();
// newItemList.Text=ce.Properties["uid"].Value.ToString();
// newItemList.Value = ce.Path.ToString();
// cboUsers.Items.Add(newItemList);
// //}
DataRow defRow = ds.Tables[0].NewRow();
defRow[0] =ce.Properties["uid"].Value.ToString();;
defRow[1] = ce.Path.ToString();
ds.Tables[0].Rows.Add(defRow);
ds.AcceptChanges();
}
DataView view = ds.Tables[0].DefaultView;
view.Sort = "uid";
cboUsers.DataSource = view;
cboUsers.DataTextField = "uid";
cboUsers.DataValueField = "path";
cboUsers.DataBind();
ListItem newItem=new ListItem();
newItem.Text="[Select One]";
newItem.Value="0";
cboUsers.Items.Insert(0,newItem);
de.Close();
}
}
Kiran
|
|
|
|
|
How can i show the y axis values on the curve i added to the graph
jeyakumar_indian
|
|
|
|
|
Dear All,
I need to convert the Excel file in the Following format to XMl file Specified Below..Please Help me to come over from this difficulty...
Taskid Name OutlineLevel Colvalue
110i Design 3 L4_R_D04.002
111i Coding 3 L4_R_D04.004
112i Testing 3 L4_R_D04.006
<tasks>
<task Taskid="110i" Name="Design" Oulinelevel="3">
<colValue>L4_R_D04.002</colValue>
</task>
<task Taskid="111i" Name="Coding" Oulinelevel="3">
<colValue>L4_R_D04.004</colValue>
</task>
..........
</tasks>
Thanks n Regards,
Ramya.R
|
|
|
|