thiago costa

thiago costa

  • NA
  • 319
  • 0

How to use the values for true or false, with out having these textboxes present?

Jan 8 2011 7:25 PM
Hello there guys

The code below works... BUT, I am using invisible textboxes to store the values inside versionS and versionL ...

How can I do the same function, and NOT have to use these invisible textboxes to store the values?
even though it works,

I'd like to avoid using WorkArrounds for this kind of stuff, to improve my learning...


THANKS GUYS ! :D

 using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using System.Net;
using System.IO;
namespace Authenticate
{
public partial class Authenticate : Form
{
public Authenticate()
{
InitializeComponent();
}

private void button1_Click(object sender, EventArgs e)
{
int serverV;
serverV = Convert.ToInt32(TBserver.Text);
serverV = int.Parse(TBserver.Text);

int localV;
localV = Convert.ToInt32(TBlocal.Text);
localV = int.Parse(TBlocal.Text);

if (serverV > localV)
{ //DO THE UPDATE CODE }

else
{ //DO NOT DO THE UPDATE CODE }

}

private void Authenticate_Load(object sender, EventArgs e)
{


WebClient Client = new WebClient();
Client.DownloadFileCompleted += new AsyncCompletedEventHandler(Completed);
Client.DownloadProgressChanged += new DownloadProgressChangedEventHandler(ProgressChanged);
Client.DownloadFileAsync(new Uri("http://98.118.57.8/anti/version.txt"), "versionS.txt");


}

private void ProgressChanged(object sender, DownloadProgressChangedEventArgs e)
{
//progressBar1.Value = e.ProgressPercentage;
}

private void Completed(object sender, AsyncCompletedEventArgs e) {


StreamReader SRlocal = new StreamReader("versionL.txt");
TBlocal.Text = SRlocal.ReadToEnd();
SRlocal.Close();


StreamReader SLserver = new StreamReader("versionS.txt");
TBserver.Text = SLserver.ReadToEnd();
SLserver.Close();



}//what ever to do after completed
}
}



... so in this case, I am transferig the value from the text file, into the invisible textbox, then converting the textbox into an integer...
But... I would like to store the 2 values other than in invisible textboxes..

Thank you

Answers (2)