Click here to Skip to main content
15,891,607 members
Home / Discussions / C#
   

C#

 
AnswerRe: How to group an array list, within a list of records, Linq GroupBy Pin
Gerry Schmitz14-Nov-20 22:31
mveGerry Schmitz14-Nov-20 22:31 
QuestionA proper way to return a list (Xamarin, CollectionView, Realm) Pin
Member 1499286214-Nov-20 9:10
Member 1499286214-Nov-20 9:10 
SuggestionRe: A proper way to return a list (Xamarin, CollectionView, Realm) Pin
Richard MacCutchan14-Nov-20 6:07
mveRichard MacCutchan14-Nov-20 6:07 
GeneralRe: A proper way to return a list (Xamarin, CollectionView, Realm) Pin
Member 1499286214-Nov-20 9:10
Member 1499286214-Nov-20 9:10 
GeneralRe: A proper way to return a list (Xamarin, CollectionView, Realm) Pin
OriginalGriff14-Nov-20 9:16
mveOriginalGriff14-Nov-20 9:16 
AnswerRe: A proper way to return a list (Xamarin, CollectionView, Realm) Pin
Mycroft Holmes14-Nov-20 12:18
professionalMycroft Holmes14-Nov-20 12:18 
GeneralRe: A proper way to return a list (Xamarin, CollectionView, Realm) Pin
Member 1499286216-Nov-20 8:17
Member 1499286216-Nov-20 8:17 
QuestionHow to selected value of a dropbox column of a DataGridView programmatically? Pin
Alex Dunlop13-Nov-20 0:41
Alex Dunlop13-Nov-20 0:41 
AnswerRe: How to selected value of a dropbox column of a DataGridView programmatically? Pin
Richard MacCutchan13-Nov-20 1:55
mveRichard MacCutchan13-Nov-20 1:55 
GeneralRe: How to selected value of a dropbox column of a DataGridView programmatically? Pin
Richard Deeming13-Nov-20 2:06
mveRichard Deeming13-Nov-20 2:06 
GeneralRe: How to selected value of a dropbox column of a DataGridView programmatically? Pin
Richard MacCutchan13-Nov-20 2:16
mveRichard MacCutchan13-Nov-20 2:16 
GeneralRe: How to selected value of a dropbox column of a DataGridView programmatically? Pin
Alex Dunlop13-Nov-20 3:09
Alex Dunlop13-Nov-20 3:09 
AnswerRe: How to selected value of a dropbox column of a DataGridView programmatically? Pin
Gerry Schmitz13-Nov-20 4:10
mveGerry Schmitz13-Nov-20 4:10 
QuestionCommented code in c# forms does it affect the performance Pin
Sachin Kulkarni B12-Nov-20 4:50
Sachin Kulkarni B12-Nov-20 4:50 
AnswerRe: Commented code in c# forms does it affect the performance Pin
OriginalGriff12-Nov-20 5:08
mveOriginalGriff12-Nov-20 5:08 
GeneralRe: Commented code in c# forms does it affect the performance Pin
trønderen12-Nov-20 7:22
trønderen12-Nov-20 7:22 
AnswerRe: Commented code in c# forms does it affect the performance Pin
Gerry Schmitz13-Nov-20 3:58
mveGerry Schmitz13-Nov-20 3:58 
QuestionThe name does not exist in the current context Pin
darkdxd11-Nov-20 22:04
darkdxd11-Nov-20 22:04 
AnswerRe: The name does not exist in the current context Pin
Richard Deeming11-Nov-20 23:01
mveRichard Deeming11-Nov-20 23:01 
AnswerRe: The name does not exist in the current context Pin
trønderen11-Nov-20 23:01
trønderen11-Nov-20 23:01 
AnswerRe: The name does not exist in the current context Pin
Richard MacCutchan11-Nov-20 23:03
mveRichard MacCutchan11-Nov-20 23:03 
It is because TXTC and TXTF are both local to the methods that they are created in. You need to create them at the class level so they are visible to both methods, thus:
C#
public partial class Weather : System.Web.UI.Page
{
    int TXTC; // will be visible to both event handlers
    int TXTF;

    protected void Page_Load(object sender, EventArgs e)
    {

    }

    protected void TextBox1_TextChanged(object sender, EventArgs e)
    {
        String C = TextBox1.Text;
        TXTC = Int32.Parse(C); // already defined at class level
        string TXTC1 = TXTC.ToString();
        TXTC = (TXTF - 32) * (5 / 9);
    }

    protected void TextBox2_TextChanged(object sender, EventArgs e)
    {
        String F = TextBox2.Text;
        TXTF = Int32.Parse(F);
        string TXTF1 = TXTF.ToString();
        TXTF = (TXTC) * (9 / 5) + 32;
    }
}


You should read up on the concept of "scope" in C# (and other languages) for a fuller explanation.
AnswerRe: The name does not exist in the current context Pin
OriginalGriff11-Nov-20 23:06
mveOriginalGriff11-Nov-20 23:06 
QuestionHow to find days between a defined date and now? Pin
Alex Dunlop10-Nov-20 7:51
Alex Dunlop10-Nov-20 7:51 
AnswerRe: How to find days between a defined date and now? Pin
Richard MacCutchan10-Nov-20 8:56
mveRichard MacCutchan10-Nov-20 8:56 
GeneralRe: How to find days between a defined date and now? Pin
Alex Dunlop10-Nov-20 16:48
Alex Dunlop10-Nov-20 16:48 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.