|
Hi,
you can tell Parse and TryParse what it is you want to allow, e.g.:
int val;
bool OK=int.TryParse("12,345", NumberStyles.AllowThousands, null, out val);
|
|
|
|
|
Hello
Tanks for your help. I used your code like below :
Int64 val;<br />
bool ok;<br />
ok = Int64.TryParse(TextBox1.Text, NumberStyles.AllowThousands, null, out val);<br />
TextBox1.Text = Convert.ToInt64(val.ToString()).ToString("#,###");<br />
The problem accures after typing more than 4 numbers. Because cursor qoes to the left side of numbers, For example i want to type 12345, after typing 4 in typing 5 it TextBox shows : 51,234
Can you help me on this?
Regards
|
|
|
|
|
use this code:
by this code,your problem is ok
private void textBox1_TextChanged(object sender, EventArgs e)
{
try
{
string ss = textBox1.Text.Replace(",", "");
int d = int.Parse(ss);
string gg = String.Format("{0:###,###,###}", d);
textBox1.Text = gg;
textBox1.SelectionStart = textBox1.Text.Length;
}
catch
{
}
}
try
{
string ss = textBox1.Text.Replace(",", "");
int d = int.Parse(ss);
string gg = String.Format("{0:###,###,###}", d);
textBox1.Text = gg;
textBox1.SelectionStart = textBox1.Text.Length;
}
catch
{
}
|
|
|
|
|
Hi again
I solved it by below code:
TextBox1.Select(TextBox1.Text.Length, 0);
Bye
|
|
|
|
|
How can i read the MAC address of a computer?
Wamuti: Any man can be an island, but islands to need water around them!
Edmund Burke: No one could make a greater mistake than he who did nothing because he could do only a little.
|
|
|
|
|
http://www.dreamincode.net/code/snippet1727.htm
|
|
|
|
|
Thank you so much . It works like magic!!
Wamuti: Any man can be an island, but islands to need water around them!
Edmund Burke: No one could make a greater mistake than he who did nothing because he could do only a little.
|
|
|
|
|
While reading the physical address of each card using WMI works, I've found it to be a little slow. If speed isn't your main concern, this is fine. However, if you want something slightly faster, then you could look into the NetworkInterface class
Between the motion
And the act
Falls the Shadow
|
|
|
|
|
I'd use the NetworkInterface class over WMI.
Also, if you're going to use the MAC for some security related conern, make sure you're using the SAME MAC every time. It's possible the machine will have multiple network interfaces and will have multiple MAC's. Also, there are additional interfaces that will show up, even though there is no physical adapter for them!
|
|
|
|
|
Warning: the MAC address can be spoofed; it equals the hardware MAC address when the system boots and/or the network connects, you can easily modify it afterwards. So it is not a reliable way for achieving software protection.
|
|
|
|
|
Hello All,
So, I am usually a .NET developer now working in a ColdFusion shop. I found out recently that the
new .NET WCF format Web Services don't play as nicely as some would have you believe, specifically,
they are quite difficult to access successfully through ColdFusion. . . . The easy answer, create
a .NET Proxy to do the actual web interaction and access the local .NET DLL from ColdFusion (much
easier to integrate). So, that is a little background on the overall project.
Now for the Question:
We are having issues with the Skew Value when trying to send to the web service. We have asked the
other end (our client) to see if they can update on their end, but we want to make sure that we are
updating on our end as well. If this was a .NET only application, I could just add three or four
lines to my app.config or web.config file and this would be an easy fix. But, since working with
ColdFusion, I can't use an app.config or web.config file with my .NET DLL (REALLY wish I could).
So, I am creating the complete proxy from scratch, and I could just use some help looking over my
work, making sure that I am doing it correctly, and making sure that I am actually setting the Skew
Value correctly.
Here is the Method that I create the Client Proxy for calling the web service (basically having to
create in code everything that would normally be in the app.config/web.config):
private static NameSpace.Web_Service.ClientProxy createClientProxy()
{
System.ServiceModel.WSHttpBinding myBinding = new System.ServiceModel.WSHttpBinding();
myBinding.Name = "SecureBinding";
myBinding.CloseTimeout = new TimeSpan(0, 1, 0);
myBinding.OpenTimeout = new TimeSpan(0, 1, 0);
myBinding.ReceiveTimeout = new TimeSpan(0, 30, 0);
myBinding.SendTimeout = new TimeSpan(0, 1, 0);
myBinding.BypassProxyOnLocal = false;
myBinding.TransactionFlow = false;
myBinding.HostNameComparisonMode = System.ServiceModel.HostNameComparisonMode.StrongWildcard;
myBinding.MaxBufferPoolSize = 524288;
myBinding.MaxReceivedMessageSize = 65536;
myBinding.MessageEncoding = System.ServiceModel.WSMessageEncoding.Text;
myBinding.TextEncoding = Encoding.UTF8;
myBinding.UseDefaultWebProxy = true;
myBinding.AllowCookies = false;
myBinding.ReaderQuotas.MaxDepth = 32;
myBinding.ReaderQuotas.MaxStringContentLength = 8192;
myBinding.ReaderQuotas.MaxArrayLength = 16384;
myBinding.ReaderQuotas.MaxBytesPerRead = 4096;
myBinding.ReaderQuotas.MaxNameTableCharCount = 16384;
myBinding.ReliableSession.Ordered = true;
myBinding.ReliableSession.InactivityTimeout = new TimeSpan(0, 10, 0);
myBinding.ReliableSession.Enabled = false;
myBinding.Security.Mode = System.ServiceModel.SecurityMode.TransportWithMessageCredential;
myBinding.Security.Transport.ClientCredentialType =
System.ServiceModel.HttpClientCredentialType.None;
myBinding.Security.Transport.ProxyCredentialType =
System.ServiceModel.HttpProxyCredentialType.None;
myBinding.Security.Transport.Realm = String.Empty;
myBinding.Security.Message.ClientCredentialType =
System.ServiceModel.MessageCredentialType.UserName;
myBinding.Security.Message.NegotiateServiceCredential = true;
myBinding.Security.Message.EstablishSecurityContext = true;
System.ServiceModel.Description.ContractDescription myContractDesc =
new System.ServiceModel.Description.ContractDescription("Web_Service_Name", "Web_Service");
System.ServiceModel.EndpointAddress myepAddress =
new System.ServiceModel.EndpointAddress("https://www.webservicelocation.com/WebServiceName/Service.svc");
System.ServiceModel.Description.ServiceEndpoint myEndpoint =
new System.ServiceModel.Description.ServiceEndpoint(myContractDesc, myBinding, myepAddress);
NameSpace.Web_Service.Client myProxy = new NameSpace.Web_Service.Client(myBinding, myepAddress);
BindingElementCollection test = myProxy.ChannelFactory.Endpoint.Binding.CreateBindingElements();
SymmetricSecurityBindingElement security = new SymmetricSecurityBindingElement();
security.LocalClientSettings.MaxClockSkew = TimeSpan.FromMinutes(30.00);
security.LocalServiceSettings.MaxClockSkew = TimeSpan.FromMinutes(30.00);
SecurityBindingElement bootStrap = new SymmetricSecurityBindingElement();
bootStrap.LocalClientSettings.MaxClockSkew = TimeSpan.FromMinutes(30.00);
bootStrap.LocalServiceSettings.MaxClockSkew = TimeSpan.FromMinutes(30.00);
SecureConversationSecurityTokenParameters secureTokenParams =
new SecureConversationSecurityTokenParameters(bootStrap);
security.ProtectionTokenParameters = secureTokenParams;
test.Add(security);
myProxy.ClientCredentials.UserName.UserName = "MyUserName";
myProxy.ClientCredentials.UserName.Password = "MyPassword";
return myProxy;
}
And the app.config file that I used to create it is:
<?xml version="1.0"?>
<configuration>
<configSections>
</configSections>
<system.serviceModel>
<bindings>
<wsHttpBinding>
<binding name="MyBinding" closeTimeout="00:01:00" openTimeout="00:01:00"
receiveTimeout="00:10:00" sendTimeout="00:01:00" bypassProxyOnLocal="false"
transactionFlow="false" hostNameComparisonMode="StrongWildcard"
maxBufferPoolSize="524288" maxReceivedMessageSize="65536" messageEncoding="Text"
textEncoding="utf-8" useDefaultWebProxy="true" allowCookies="false">
<readerQuotas maxDepth="32" maxStringContentLength="8192" maxArrayLength="16384"
maxBytesPerRead="4096" maxNameTableCharCount="16384" />
<reliableSession ordered="true" inactivityTimeout="00:10:00" enabled="false" />
<security mode="TransportWithMessageCredential">
<transport clientCredentialType="None" proxyCredentialType="None" realm="" />
<message clientCredentialType="UserName" negotiateServiceCredential="true"
algorithmSuite="Default" establishSecurityContext="true" />
</security>
</binding>
<binding name="SecureBinding" closeTimeout="00:01:00" openTimeout="00:01:00"
receiveTimeout="00:10:00" sendTimeout="00:01:00" bypassProxyOnLocal="false"
transactionFlow="false" hostNameComparisonMode="StrongWildcard" maxBufferPoolSize="524288"
maxReceivedMessageSize="65536" messageEncoding="Text" textEncoding="utf-8" useDefaultWebProxy="true"
allowCookies="false">
<readerQuotas maxDepth="32" maxStringContentLength="8192" maxArrayLength="16384" maxBytesPerRead="4096"
maxNameTableCharCount="16384" />
<reliableSession ordered="true" inactivityTimeout="00:10:00" enabled="false" />
<security mode="TransportWithMessageCredential">
<transport clientCredentialType="None" proxyCredentialType="None" realm="" />
<message clientCredentialType="UserName" negotiateServiceCredential="true" algorithmSuite="Default"
establishSecurityContext="true" />
</security>
</binding>
</wsHttpBinding>
</bindings>
<client>
<endpoint address="https://www.WebServiceSite.com/WebService/Service.svc" binding="wsHttpBinding"
bindingConfiguration="MyBinding" contract="Web_Service" name="MyEndpoint" />
<endpoint address="https://www.WebServiceSite.com/WebService/Service.svc" binding="wsHttpBinding"
bindingConfiguration="SecureBinding" contract="NameSpace.WebService" name="SecureBinding" />
</client>
</system.serviceModel>
<appSettings>
<add key="UserName" value="MyUserName" />
<add key="Password" value="MyPassword" />
<add key="ClientSettingsProvider.ServiceUri" value="" />
</appSettings>
<startup>
<supportedRuntime version="v2.0.50727" />
</startup>
<system.web>
<membership defaultProvider="ClientAuthenticationMembershipProvider">
<providers>
<add name="ClientAuthenticationMembershipProvider"
type="System.Web.ClientServices.Providers.ClientFormsAuthenticationMembershipProvider,
System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"
serviceUri="" />
</providers>
</membership>
<roleManager defaultProvider="ClientRoleProvider" enabled="true">
<providers>
<add name="ClientRoleProvider" type="System.Web.ClientServices.Providers.ClientRoleProvider,
System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"
serviceUri="" cacheTimeout="86400" />
</providers>
</roleManager>
</system.web>
</configuration>
If someone could let me know if there are any problems, It works, it runs, and for a while it was fine, but when the two clocks get over 5 minutes apart, it is still having issues. I am trying to figure out if it is just me, or if it is the other end. . . . Any suggestions, any help? Thanks all.
Michael Palmer
"All the world's a chip
And all the men and women merely transistors
They have their inputs and their outputs
And one man, in his time, processes many bytes."
~William Shakespeare~ (coined)
|
|
|
|
|
I've a string that contains ShowVideo('sdsdsdsdsd,1,2'); and I want to replace it with new string but before replace I need to retrieve its values(i.e. 'sdsdsdsdsd,1,2'). So I thought to use Regex but I stuck. Actually I'm not good in that thing...I tried following code but I dunno what to write next. I read alot of examples and articles but I couldn't figure it out that how this thing is working...
string data = "NotShowVideo('sdsdsdsdsd,1,2'); ShowVideo('sdsdsdsdsd,1,2'); % ";
Regex r = new Regex(@"ShowVideo");
MatchCollection mc = r.Matches(data);
for (int a = 0; a < mc.Count; a++)
{
Match m = mc[a];
}
any help would be nice
TVMU^P[[IGIOQHG^JSH`A#@`RFJ\c^JPL>;"[,*/|+&WLEZGc`AFXc!L
%^]*IRXD#@GKCQ`R\^SF_WcHbORY87֦ʻ6ϣN8ȤBcRAV\Z^&SU~%CSWQ@#2
W_AD`EPABIKRDFVS)EVLQK)JKQUFK[M`UKs*$GwU#QDXBER@CBN%
R0~53%eYrd8mt^7Z6]iTF+(EWfJ9zaK-iTV.C\y<pjxsg-b$f4ia>
-----------------------------------------------
128 bit encrypted signature, crack if you can
|
|
|
|
|
How about '(\w+),(\d+),(\d+)' ?
|
|
|
|
|
thanks, I'm using the following one
\bShowVideo\('(\w+),(\d+),(\d+)'\);
TVMU^P[[IGIOQHG^JSH`A#@`RFJ\c^JPL>;"[,*/|+&WLEZGc`AFXc!L
%^]*IRXD#@GKCQ`R\^SF_WcHbORY87֦ʻ6ϣN8ȤBcRAV\Z^&SU~%CSWQ@#2
W_AD`EPABIKRDFVS)EVLQK)JKQUFK[M`UKs*$GwU#QDXBER@CBN%
R0~53%eYrd8mt^7Z6]iTF+(EWfJ9zaK-iTV.C\y<pjxsg-b$f4ia>
-----------------------------------------------
128 bit encrypted signature, crack if you can
|
|
|
|
|
what attch or detach in c# ?plz me query sqlserver ?plz example
plz me query attch ,detach
modified on Friday, September 4, 2009 1:24 PM
|
|
|
|
|
you use the question mark symbol but I don't think your words qualify to be questions.
you want to load/save data to/from SQL server? then have a look at this[^]
Life goes very fast. Tomorrow, today is already yesterday.
|
|
|
|
|
http://www.mssqlcity.com/Articles/Adm/attach_database.htm
|
|
|
|
|
sos_amin wrote: what attch or detach in c# ?plz me query sqlserver ?plz example
plz me query attch ,detach
You actually modified this query? I assume it was even more nonsensical in the original - it's not right to use txtspk in the forums, please desist.
"WPF has many lovers. It's a veritable porn star!" - Josh Smith As Braveheart once said, "You can take our freedom but you'll never take our Hobnobs!" - Martin Hughes.
My blog | My articles | MoXAML PowerToys | Onyx
|
|
|
|
|
i am having dataset in database file. i want to call a method which will be giving a complete values of dataset.tables. column from database code file to a combox.datasource.
|
|
|
|
|
Take a look at this Walkthrough on MSDN[^], it should give you some ideas.
Henry Minute
Do not read medical books! You could die of a misprint. - Mark Twain
Girl: (staring) "Why do you need an icy cucumber?"
“I want to report a fraud. The government is lying to us all.”
|
|
|
|
|
Kindly suggest the name of book which is cover all the topics and points for making an complete application in C#.net. is their any E.books covering all the topics.
thanks
|
|
|
|
|
amaankhan wrote: all the topics and points
This is broad of a field and subject to be covered in one tome.
only two letters away from being an asset
|
|
|
|
|
how can I check if a user on Facebook is online or offline in order to show a notification to the user?
|
|
|
|
|
|
how can I check if a user on Yahoo Messenger is online or offline in order to show a notification to the user?
|
|
|
|
|