Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6169543
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T22:52:28+00:00 2026-05-23T22:52:28+00:00

i have listview one button( default content == Add) and 1 textbox. On list

  • 0

i have listview one button( default content == “Add”) and 1 textbox. On list view double click event buttons.Content==”Edit” and text box fills with information from listview.

this if statment does not work correctly

            if (btnAddFloor.Content == "Add")
            {
                HProDataContext db = new HProDataContext();
                floor f = new floor { floorname = txtFloorName.Text };
                db.floors.InsertOnSubmit(f);
                db.SubmitChanges();
                RefreshListViewFloor();
            }
            else
            {
                int currentID = Convert.ToInt32(listViewFloors.SelectedValue);

                HProDataContext db = new HProDataContext();
                floor f = db.floors.Single(p => p.id == currentID);
                f.floorname = txtFloorName.Text;
                db.SubmitChanges();
                RefreshListViewFloor();
                txtFloorName.Text = null;
                RefreshListViewRoom();
            }

and on btnAddFloor.Content == “Add” is green underline
can anyone help me?

XAML

    <GroupBox Header="Floors" Height="287" HorizontalAlignment="Left" Margin="12,32,0,0" Name="GroupBoxFloors" VerticalAlignment="Top" Width="342">
        <Grid>
            <Button Content="Add" Height="23" HorizontalAlignment="Left" Margin="169,37,0,0" Name="btnAddFloor" VerticalAlignment="Top" Width="75" Click="btnAddFloor_Click" />
            <ListView Height="192" HorizontalAlignment="Left" Margin="6,66,0,0" Name="listViewFloors" VerticalAlignment="Top" Width="318" ItemsSource="{Binding FloorCollection}" SelectedValuePath="ID" MouseDoubleClick="listViewFloors_MouseDoubleClick">
                <ListView.View >
                    <GridView>
                        <GridViewColumn Header="ID" Width="60" DisplayMemberBinding="{Binding ID}"/>
                        <GridViewColumn Header="FloorName" Width="200" DisplayMemberBinding="{Binding FloorName}"/>

                    </GridView>
                </ListView.View>
            </ListView>
            <TextBox Height="23" HorizontalAlignment="Left" Margin="6,37,0,0" Name="txtFloorName" VerticalAlignment="Top" Width="157" TextChanged="txtFloorName_TextChanged" />
            <Button Content="Remove" Height="23" HorizontalAlignment="Left" Margin="249,37,0,0" Name="btnRemoveFloor" VerticalAlignment="Top" Width="75" Click="btnRemoveFloor_Click" />
            <Label Content="Floor Name" Height="28" HorizontalAlignment="Left" Margin="6,6,0,0" Name="label1" VerticalAlignment="Top" />
        </Grid>
    </GroupBox>
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-23T22:52:28+00:00Added an answer on May 23, 2026 at 10:52 pm

    Button.Content is of type Object, using the “==” operator will compare pointers.
    What you want to do is:

    btnAddFloor.Content.ToString() == “Add”

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a list view control which at the moment only allows one item
Ok, so I have a listview on one form, and when a button is
I have a ListView with let's say 5 items. When I click on one
Can you have a multicolumn listview control where one of the columns is a
I have a ListView on a page that displays a list of widgets. When
i have a listview with 2 or more radio button controls in each row
I have a ListView that has a Button in the item template. Is there
In my android app I have a Tabhost with a ListView as one of
I have a listview, which displays a list of administrators, this list is held
I have WPF ListView with GridView view and I want to remove any trace

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.