Hi, I'm pulling my hair out. I have created a class "employee.cs". I developed this class originally within the "public partial class Window1 : Window" on "Window1.xaml.cs". When moving it to a sepate class I can no longer refernce textBoxes, comboBoxes etc. What do I do?? Error given is "The name 'textBox1' does not exist in the current context". I'm sure its simple! Thanks Guys!
Here's a cut back example!
Window1.xaml
<Window x:Class="WpfApplication6.Window1"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
Title="Window1" Height="300" Width="300">
<Grid>
<TextBox Height="100" Margin="12,12,23,0" Name="textBox1" VerticalAlignment="Top" />
</Grid>
</Window>
Window1.xaml.cs
namespace WpfApplication6
{
public partial class Window1 : Window
{
public Window1()
{
InitializeComponent();
textBox1.Text = "testing"; //Works Here!
}
}
}
Class.cs
namespace WpfApplication6
{
class class1
{
public static void main()
{
textBox1.Text = "Help"; //Doesn't Work Here!! :-(
}
}
}