Hello!
I'd like to ask for some help. I have the following code:

private void Combobox1_SelectedIndexChanged(object sender, EventArgs e)
        {
            runstylize(lCombobox1, leftborderstyle, "left");

        }
 public void getborderstyle(ComboBox x, string y, string z)
        {
           
            y = z+"-was set to:" + x.SelectedItem.ToString() ;
            
            change();
           
        }

My question is: why is the string "leftborderstyle" (which become y in my logic) hasn't got any value after the proccess? It is a public string, defined in the initializecomponent section. What should I do to set y's value to it?

Thanks in advance!

Hello, konczuras. I think that this article will help you to make out with using reference and value types and ways of passing them into methods:Passing Parameters

Try passing the string by reference. In this case, just do this:

private void Combobox1_SelectedIndexChanged(object sender, EventArgs e)
        {
            runstylize(lCombobox1, ref leftborderstyle, "left");

        }
 public void getborderstyle(ComboBox x, ref string y, string z)
        {
           
            y = z+"-was set to:" + x.SelectedItem.ToString() ;
            
            change();
           
        }
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.