visual studio - I can't seem to change the window form text in C# -
i'm using visual studio create program. far, has 1 window button.
in form1.designer.cs, initializes window:
namespace test { private void initializecomponent() { // took out else, isn't needed. // // formmain // this.autoscaledimensions = new system.drawing.sizef(6f, 13f); this.autoscalemode = system.windows.forms.autoscalemode.font; this.backcolor = system.drawing.systemcolors.controllightlight; this.clientsize = new system.drawing.size(624, 442); this.icon = ((system.drawing.icon)(resources.getobject("$this.icon"))); this.name = "formmain"; this.text = "program name"; this.load += new system.eventhandler(this.formmain_load); this.menubar.resumelayout(false); this.menubar.performlayout(); this.resumelayout(false); this.performlayout(); } }
in form1.cs:
private void button1_click(object sender, eventargs e) { formmain.activeform.text = formmain.activeform.text + " - project name"; }
...but doesn't change window text after click button. i've tried formmain.activeform.refresh()
after changing text, didn't work. i've search high , low solution, i'm new c#. of have ideas me?
did try that?
private void button1_click(object sender, eventargs e) { this.text = "works!"; }
Comments
Post a Comment