Why does this not work :
if (This_Ver.Text == New_Ver.Text)
{
MAIN_PANEL.Visible = true;
}
else if (This_Ver.Text != New_Ver.Text)
{
DialogResult dialogResult = MessageBox.Show("An update has been found!" + Environment.NewLine + "Would you like to download and install it?", "Update found!", MessageBoxButtons.YesNo, MessageBoxIcon.Information);
if (dialogResult == DialogResult.Yes)
{
MAIN_PANEL.Visible = false;
UPDATE_PANEL.Visible = true;
USERNAME_TEXT.Enabled = false;
PASSWORD_TEXT.Enabled = false;
LOGIN_BUTTON.Enabled = false;
MAIN_PANEL.Visible = false;
UPDATE_NOW_BUTTON.Enabled = true;
}
else if (dialogResult == DialogResult.No)
{
UPDATE_NOW_BUTTON.Enabled = true;
MAIN_PANEL.Visible = true;
}
}
I am trying to compare the new version and the current running version. It should open the updater panel when the textboxes does not contain the same version.
But It doesn't work. It always opens the updater panel.
EDIT :
value : This_Ver.Text : V1.1.13.1
value : New_Ver.Text : V1.1.13.1
Try like below may be it will help you you..
change your code
FROM :
if (This_Ver.Text == New_Ver.Text)
TO :
if (This_Ver.Text.ToUpper().Trim().Equals(This_Ver.Text.ToUpper().Trim()))
Try Something like this
string value1 = This_Ver.Text.Trim();
string value2 = New_Ver.Text.Trim();
if(value1 == value2 )
{
//hide your panel
}
else
{
// code something
}
if value matches it hides otherwise it goes to else
part where you do some logic code.
Aslo want to know what values are you getting in value1,value2
while debugging on IF Condition
You must use (This_Ver.Text.Equals(New_Ver.Text)) because == comparator will not work. As in Java, == comparator do object references comparation. In contrast, Equals method compares strings content.
Good Luck.
Why does this not work :
if (This_Ver.Text == New_Ver.Text)
{
MAIN_PANEL.Visible = true;
}
else if (This_Ver.Text != New_Ver.Text)
{
DialogResult dialogResult = MessageBox.Show("An update has been found!" + Environment.NewLine + "Would you like to download and install it?", "Update found!", MessageBoxButtons.YesNo, MessageBoxIcon.Information);
if (dialogResult == DialogResult.Yes)
{
MAIN_PANEL.Visible = false;
UPDATE_PANEL.Visible = true;
USERNAME_TEXT.Enabled = false;
PASSWORD_TEXT.Enabled = false;
LOGIN_BUTTON.Enabled = false;
MAIN_PANEL.Visible = false;
UPDATE_NOW_BUTTON.Enabled = true;
}
else if (dialogResult == DialogResult.No)
{
UPDATE_NOW_BUTTON.Enabled = true;
MAIN_PANEL.Visible = true;
}
}
I am trying to compare the new version and the current running version. It should open the updater panel when the textboxes does not contain the same version.
But It doesn't work. It always opens the updater panel.
EDIT :
value : This_Ver.Text : V1.1.13.1
value : New_Ver.Text : V1.1.13.1
Try like below may be it will help you you..
change your code
FROM :
if (This_Ver.Text == New_Ver.Text)
TO :
if (This_Ver.Text.ToUpper().Trim().Equals(This_Ver.Text.ToUpper().Trim()))
Try Something like this
string value1 = This_Ver.Text.Trim();
string value2 = New_Ver.Text.Trim();
if(value1 == value2 )
{
//hide your panel
}
else
{
// code something
}
if value matches it hides otherwise it goes to else
part where you do some logic code.
Aslo want to know what values are you getting in value1,value2
while debugging on IF Condition
You must use (This_Ver.Text.Equals(New_Ver.Text)) because == comparator will not work. As in Java, == comparator do object references comparation. In contrast, Equals method compares strings content.
Good Luck.
0 commentaires:
Enregistrer un commentaire