ASPForums.Net RSS Feedhttp://www.aspforums.net/Handlers/RSS.ashxLatest additions to the content that appears on ASPForums.Net(c) 2017 www.aspforums.com. All rights reserved.How to pass string value from Public Class to public partial class in C#<p>In your class create a Public method and then call it in your Partial class</p>http://www.aspforums.net/Threads/163835/How-to-pass-string-value-from-Public-Class-to-public-partial-class-in-C/http://www.aspforums.net/Threads/163835/How-to-pass-string-value-from-Public-Class-to-public-partial-class-in-C/Thu, 02 Aug 2012 03:44:44 GMTHow to pass string value from Public Class to public partial class in C#<p>I have created public Method in first class,but when I put breakpoint at this method debugger is not at all coming at this method so the the vlaue is not coming in the string which I have declared in Public Method so and I cant able to use it in another class.Please have a kind look at my code.</p> <pre class="brush: csharp">public class SMSHelper { public static string smsstatusnew; string smsstatus; string[] res; public SMSResultStatusEnum SendSMS(StringBuilder mobilenumber, string message, string Language) { string Unicode; string SMSUsername = AppSettingsManager.Instance.SMSUsername; string SMSPassword = AppSettingsManager.Instance.SMSPassword; string SMSSenderID = AppSettingsManager.Instance.SMSSenderID; string correctedmobilenumber = CorrectMobileNumber(mobilenumber); ///@todo: REMOVE THIS IN PRODUCTION! //return // SMSResultStatus.SUCCESSFUL; if (Language.ToLower() == &#34;english&#34;) { Unicode = &#34;E&#34;; } else { Unicode = &#34;U&#34;; message = ToHexString(message); } //Uri uri = new Uri(&#34;http://59.162.167.52/api/MessageCompose?admin=imran@instareach.com&amp;user=&#34; + SMSUsername + &#34;:&#34; + SMSPassword + &#34;&amp;senderID=&#34; + SMSSenderID + &#34;&amp;receipientno=&#34; + correctedmobilenumber + &#34;&amp;msgtxt=&#34; + message + &#34;&amp;state=4&#34;); Uri uri = new Uri(&#34;http://183.81.161.84:13016/cgi-bin/sendsms?username=&#34; + SMSUsername + &#34;&amp;password=&#34; + SMSPassword + &#34;&amp;to=&#34; + correctedmobilenumber + &#34;&amp;from=&#34; + SMSSenderID + &#34;&amp;text=&#34; + message); try { HttpWebRequest httpReq = (HttpWebRequest)WebRequest.Create(uri); HttpWebResponse httpResponse = (HttpWebResponse)(httpReq.GetResponse()); StreamReader reader = new StreamReader(httpResponse.GetResponseStream()); string tmp = reader.ReadToEnd(); res = tmp.Split(&#39;&amp;&#39;); //string Result = tmp.Substring(0, 8) + &#34;&#34;.ToString(); httpResponse.Close(); //SMSResultStatusEnum statusCode = (SMSResultStatusEnum)SMSResultStatusEnum.Successfull; if (res[0] == &#34;status=0&#34;) { SMSResultStatusEnum statusCode = (SMSResultStatusEnum)SMSResultStatusEnum.Successfull; return statusCode; } else if (res[0] == &#34;status=1&#34;) { SMSResultStatusEnum statusCode = (SMSResultStatusEnum)SMSResultStatusEnum.AuthorisationFailed; return statusCode; } else if (res[0] == &#34;status=28&#34;) { SMSResultStatusEnum statusCode = (SMSResultStatusEnum)SMSResultStatusEnum.InvalidDestinationNumber; return statusCode; } else { SMSResultStatusEnum statusCode = (SMSResultStatusEnum)SMSResultStatusEnum.OtherProblems; return statusCode; } //return statusCode; } catch { return SMSResultStatusEnum.OtherProblems; } } public void SMSStatus() { smsstatus = res[0]; smsstatusnew = smsstatus; } }</pre> <p>&nbsp;</p>http://www.aspforums.net/Threads/163835/How-to-pass-string-value-from-Public-Class-to-public-partial-class-in-C/http://www.aspforums.net/Threads/163835/How-to-pass-string-value-from-Public-Class-to-public-partial-class-in-C/Thu, 02 Aug 2012 04:33:45 GMTHow to pass string value from Public Class to public partial class in C#<p>How are you calling this public method?</p>http://www.aspforums.net/Threads/163835/How-to-pass-string-value-from-Public-Class-to-public-partial-class-in-C/http://www.aspforums.net/Threads/163835/How-to-pass-string-value-from-Public-Class-to-public-partial-class-in-C/Thu, 02 Aug 2012 04:35:19 GMTHow to pass string value from Public Class to public partial class in C#<p>In Public Partial class as</p> <p>string smsstatus =SMSHelper.smsstatusnew;</p>http://www.aspforums.net/Threads/163835/How-to-pass-string-value-from-Public-Class-to-public-partial-class-in-C/http://www.aspforums.net/Threads/163835/How-to-pass-string-value-from-Public-Class-to-public-partial-class-in-C/Thu, 02 Aug 2012 04:37:00 GMTHow to pass string value from Public Class to public partial class in C#<div class="body"> <p>In Public Partial class(page class) as</p> <p>string smsstatus =SMSHelper.smsstatusnew;</p> </div>http://www.aspforums.net/Threads/163835/How-to-pass-string-value-from-Public-Class-to-public-partial-class-in-C/http://www.aspforums.net/Threads/163835/How-to-pass-string-value-from-Public-Class-to-public-partial-class-in-C/Thu, 02 Aug 2012 04:38:20 GMTHow to pass string value from Public Class to public partial class in C#<p>Call this way</p> <pre class="brush: csharp">SMSHelper sms = new SMSHelper(); sms.SendSMS();</pre> <p>&nbsp;</p>http://www.aspforums.net/Threads/163835/How-to-pass-string-value-from-Public-Class-to-public-partial-class-in-C/http://www.aspforums.net/Threads/163835/How-to-pass-string-value-from-Public-Class-to-public-partial-class-in-C/Thu, 02 Aug 2012 04:47:58 GMTHow to pass string value from Public Class to public partial class in C#<p>Thanks for you reply,please tell me which method should I call whether first one or new one(public Method) which Just I created.</p> <p>public SMSResultStatusEnum SendSMS(StringBuilder mobilenumber, string message, string Language)<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; {<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; string Unicode;<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; string SMSUsername = AppSettingsManager.Instance.SMSUsername;<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; string SMSPassword = AppSettingsManager.Instance.SMSPassword;<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; string SMSSenderID = AppSettingsManager.Instance.SMSSenderID;<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; string correctedmobilenumber = CorrectMobileNumber(mobilenumber);<br /><br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ///@todo: REMOVE THIS IN PRODUCTION!<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; //return<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; //&nbsp;&nbsp;&nbsp; SMSResultStatus.SUCCESSFUL;<br /><br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; if (Language.ToLower() == "english")<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; {<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Unicode = "E";<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; }<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; else<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; {<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Unicode = "U";<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; message = ToHexString(message);<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; }<br /><br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; //Uri uri = new Uri("http://59.162.167.52/api/MessageCompose?admin=imran@instareach.com&amp;user=" + SMSUsername + ":" + SMSPassword + "&amp;senderID=" + SMSSenderID + "&amp;receipientno=" + correctedmobilenumber + "&amp;msgtxt=" + message + "&amp;state=4");<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Uri uri = new Uri("http://183.81.161.84:13016/cgi-bin/sendsms?username=" + SMSUsername + "&amp;password=" + SMSPassword + "&amp;to=" + correctedmobilenumber + "&amp;from=" + SMSSenderID + "&amp;text=" + message);<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; try<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; {<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; HttpWebRequest httpReq = (HttpWebRequest)WebRequest.Create(uri);<br /><br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; HttpWebResponse httpResponse = (HttpWebResponse)(httpReq.GetResponse());<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; StreamReader reader = new StreamReader(httpResponse.GetResponseStream());<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; string tmp = reader.ReadToEnd();<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; res = tmp.Split('&amp;');<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; //string Result = tmp.Substring(0, 8) + "".ToString();<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; httpResponse.Close();<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; //SMSResultStatusEnum statusCode = (SMSResultStatusEnum)SMSResultStatusEnum.Successfull;<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; if (res[0] == "status=0")<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; {<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; SMSResultStatusEnum statusCode = (SMSResultStatusEnum)SMSResultStatusEnum.Successfull;<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; return statusCode;<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; }<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; else if (res[0] == "status=1")<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; {<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; SMSResultStatusEnum statusCode = (SMSResultStatusEnum)SMSResultStatusEnum.AuthorisationFailed;<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; return statusCode;<br /><br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; }<br /><br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; else if (res[0] == "status=28")<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; {<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; SMSResultStatusEnum statusCode = (SMSResultStatusEnum)SMSResultStatusEnum.InvalidDestinationNumber;<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; return statusCode;<br /><br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; }<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; else<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; {<br /><br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; SMSResultStatusEnum statusCode = (SMSResultStatusEnum)SMSResultStatusEnum.OtherProblems;<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; return statusCode;<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; }<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; //return statusCode;<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; }<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; catch<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; {<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; return SMSResultStatusEnum.OtherProblems;<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; }<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; }</p> <p>&nbsp;</p> <p>&nbsp;</p> <p>&nbsp;</p> <p>or this</p> <p>&nbsp;</p> <p>&nbsp; public void SMSStatus()<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; {<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; smsstatus = res[0];<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; smsstatusnew = smsstatus;<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; }</p>http://www.aspforums.net/Threads/163835/How-to-pass-string-value-from-Public-Class-to-public-partial-class-in-C/http://www.aspforums.net/Threads/163835/How-to-pass-string-value-from-Public-Class-to-public-partial-class-in-C/Thu, 02 Aug 2012 05:02:48 GMTHow to pass string value from Public Class to public partial class in C#<p>Can't say as I have no idea about this class, either you contact its author who build it or try calling them in different ways to see which way works</p>http://www.aspforums.net/Threads/163835/How-to-pass-string-value-from-Public-Class-to-public-partial-class-in-C/http://www.aspforums.net/Threads/163835/How-to-pass-string-value-from-Public-Class-to-public-partial-class-in-C/Thu, 02 Aug 2012 05:13:55 GMT