Error in SaveDialog c #

1

Well, I have this excerpt of code in C # and everything is working, but I have an error that I still can not solve, as you can see in the image and in the code. Label1 is fetching text from a textbox, as you can see here:

I just want the "M000050" to appear. What is before does not matter if it appears because it does not allow recording.

ERROR

CODE

privatevoidbutton1_Click(objectsender,EventArgse){SaveFileDialogsalvar=newSaveFileDialog();salvar.FileName=label1+".cnf";
        salvar.Filter = "Ficheiro de Configuração|*.cnf";
        salvar.DefaultExt = "txt";
        DialogResult salvou = salvar.ShowDialog();
        (...)
 }
    
asked by anonymous 19.05.2015 / 13:33

1 answer

1

Change:

salvar.FileName = label1 + ".cnf";

To:

salvar.FileName = label1.Text + ".cnf";

    
19.05.2015 / 14:19