c# - using local variable in another button -


there's error: "the type being set not compatible value representation of tag."

  string fi = null;           public void reading(object sender, eventargs e)     {          read_from_folder = folderbrowserdialog1.showdialog();          if (read_from_folder == dialogresult.ok)         {             files_in_folder = directory.getfiles(folderbrowserdialog1.selectedpath);              foreach (string fi files_in_folder)             {                 string fi_nam = filese_in_folder.tostring();                  ...              }           }        }        private void button1_click(object sender, eventargs e)     {                 dicomdirectory cop = new dicomdirectory(fi);                  cop.load(fi);     }  

i agree frederik, local fi hides class-level member. isn't clear expect in variable in button click handler.

because you're looping, if use class member fi, you'll have last file referenced. doesn't make sense. if searching match, say, in loop, , stopping on match, un-hiding class-level fi make sense, , code have work. trying fi?

also, loop have won't work listed... should be:

//  missing 'in' foreach (string fi in files_in_folder) 


* update * in response changes in question, getting error? in button click event? on line? sounds custom internal error dicomdirectory object, whatever is.


Comments

Popular posts from this blog

c++ - Convert big endian to little endian when reading from a binary file -

C#: Application without a window or taskbar item (background app) that can still use Console.WriteLine() -

unicode - Are email addresses allowed to contain non-alphanumeric characters? -