Click here to Skip to main content
15,888,190 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
C#
public partial class Login : System.Web.UI.Page
{
   
    public static Double elong1, elat1;

   public static Double Elong1
    {
        get { return Login.elong1; }
        set { Login.elong1 = value; }
    }

       public static Double Elat1
    {
        get { return Login.elat1; }
        set { Login.elat1 = value; }
    }

 public void Button1_Click(object sender, EventArgs e)
    {

String sLong1 = geocodeXmlDoc1.DocumentElement.SelectSingleNode(@"//geometry/location/lat", XmlMngr1).InnerText;
        String sLat1 = geocodeXmlDoc1.DocumentElement.SelectSingleNode(@"//geometry/location/lng", XmlMngr1).InnerText;



elong1 = Convert.ToDouble(sLong1);
elat1 = Convert.ToDouble(sLat1);

}
// this is a sample class
public class harversine
    {

     String loudlong1 = Convert.ToString(elong1);
     String loudlat1 = Convert.ToString(elat1);

       // let say i want pass Fanswer to Textbox in button click event
     String Fanswer = loudlong1 + ", " + loudlat1;

}


this all are samples and i want to see if this correct or not before i'm writing a original code.

i'm a student and i'm new to the field as well. so someone please kindly help me to correct this if i'm wrong.
Posted
Updated 30-Jun-13 23:17pm
v2
Comments
Thanks7872 1-Jul-13 5:50am    
You can check that yourself. If it fulfills what you want then its correct,otherwise not.
promod madushan 1-Jul-13 5:56am    
if i can do it myself i don't ask for help my friend!!!!!
[no name] 1-Jul-13 6:08am    
No it is not correct. Your code would not even compile.
promod madushan 1-Jul-13 6:15am    
@ThePhantomUpvoter

don't care about api things geocode,etc.
i have done that and its working...

i just publish variables which i want to access in another class and if this wrong i just want a propper way to access this variables in another class.
[no name] 1-Jul-13 7:33am    
If you do not care enough to ask a proper question then why should we care enough to give you any answer?
You have already been told how to do this over and over. I do not see any benefit at all to telling you yet again.
You would be far better off by getting a book on basic programming and going through it. Or find some tutorials. We cannot possibly teach you how to write programs over the internet one question at a time.

TryParse will only work on .net frame work 4.
 
Share this answer
 
Comments
promod madushan 1-Jul-13 5:45am    
@manu v nath
i want to pass Fanswer to button click event know.
so
the answer gonna be
TryParse(Fanswer);

then i can pass the value of Fanswer to label or textbox easily in button click event.
Right
Label1.Text = Fanswer;
is this okay
lukeer 1-Jul-13 6:18am    
No. AFAIK, it works since version v1.1, but definitely since before v4[^].
Try Parse may helps yor in this case,
for example:
Double.TryParse(

Thanks
--RA
 
Share this answer
 
Comments
promod madushan 1-Jul-13 5:43am    
@Rajesh
i want to pass Fanswer to button click event know.
so
the answer gonna be
Double.TryParse(Fanswer);
right.
So is this correct.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900