Transforming Checkboxlist Labels into strings

Asked

Viewed 117 times

0

I have a checkboxlist with some items and their name are the directories so I can save the file. I wonder how I get the name of each label selected from checkboxlist and turn it into a string. I would like to know a way for it to save multiple files at once, which are the ones on checkboxlist.

private void bt_salvar_Click(object sender, EventArgs e)
{
    clsMCI clsmci = new clsMCI();
    string ArtistaDoAlbum;
    string Artista;
    TagLib.File tagFile = TagLib.File.Create(aqui onde gostaria que o nome da label selecionada estivesse);
    tagFile.Tag.Title = tx_titulo.Text;
    tagFile.Save();
}

1 answer

3

Here are some examples of how to capture the text of a Checkboxlist

string ex1 = chkLista.SelectedItem.Text;
string ex2 = chkLista.Items[0].Text;

To save a record for each item I believe that the best way is for you to do a foreach, in case you have misunderstood please drill into the problem.

OBS: chkLista = ID OF YOUR OBJECT

  • I tried using the Listitem class, only I couldn’t add this class to the visual studio.

Browser other questions tagged

You are not signed in. Login or sign up in order to post.