Govind Sankar
Active member
- Joined
- May 15, 2020
- Messages
- 42
- Programming Experience
- Beginner
Hi,
I have created an application for learning purposes. Its a wpf application. The application works like this. First is the main window. It has a button called open and a textbox. When I click on open a new window will open up. This new window has 3 textboxes and 1 button ok. The three textboxes are for entering your first name, middle name and last name. So when we enter all these 3 and press ok then this window will close and go to the main window. In the main window in the text box it will appear "My Name is " plus the First Name, Middle Name and Last Name we entered. This is the program. But the problem is the last letter of the last name is not coming. For eg : I entered First Name as Johny, Middle Name as Christopher and Last Name as Depp. But the output that is coming is Johny Christopher Dep, without the last p. I also tried without entering the last name and just first and middle name as Johny and Christopher respectively and Last Name left blank. Then the output is Johny Christophe without the last e. I tried with only the first name and middle and last name left blank. Then instead of johny, only John is coming without the last y. So why is this happening. Kindly help me. You can find the program below. I have also uploaded the screenshot of the problem.
I have created an application for learning purposes. Its a wpf application. The application works like this. First is the main window. It has a button called open and a textbox. When I click on open a new window will open up. This new window has 3 textboxes and 1 button ok. The three textboxes are for entering your first name, middle name and last name. So when we enter all these 3 and press ok then this window will close and go to the main window. In the main window in the text box it will appear "My Name is " plus the First Name, Middle Name and Last Name we entered. This is the program. But the problem is the last letter of the last name is not coming. For eg : I entered First Name as Johny, Middle Name as Christopher and Last Name as Depp. But the output that is coming is Johny Christopher Dep, without the last p. I also tried without entering the last name and just first and middle name as Johny and Christopher respectively and Last Name left blank. Then the output is Johny Christophe without the last e. I tried with only the first name and middle and last name left blank. Then instead of johny, only John is coming without the last y. So why is this happening. Kindly help me. You can find the program below. I have also uploaded the screenshot of the problem.
C#:
//MainWindow
namespace NewClassLearn
{
/// <summary>
/// Interaction logic for MainWindow.xaml
/// </summary>
public partial class MainWindow : Window
{
string message1 = "My Name is ";
string TotalMessage;
public MainWindow()
{
InitializeComponent();
}
private void Open_Click(object sender, RoutedEventArgs e)
{
var use = new GetValueForLearn();
use.ShowDialog();
string Fname = use.getFname();
string Mname = use.getMname();
string Lname = use.getLname();
//MessageBox.Show(Lname);
TotalMessage = message1 + Fname + " " + Mname + " " + Lname + " ";
FullName.Text = TotalMessage;
}
}
}
//SubWindow also called GetValueForLearn
namespace NewClassLearn.RetValue
{
/// <summary>
/// Interaction logic for GetValueForLearn.xaml
/// </summary>
public partial class GetValueForLearn : Window
{
public string Fname;
public string Mname;
public string Lname;
public GetValueForLearn()
{
InitializeComponent();
}
private void OK_Click(object sender, RoutedEventArgs e)
{
this.Close();
}
private void FNameTB_KeyDown(object sender, KeyEventArgs e)
{
Fname = FNameTB.Text;
}
private void MNameTB_KeyDown(object sender, KeyEventArgs e)
{
Mname = MNameTB.Text;
}
private void LNameTB_KeyDown(object sender, KeyEventArgs e)
{
Lname = LNameTB.Text;
}
public string getFname()
{
return Fname;
}
public string getMname()
{
return Mname;
}
public string getLname()
{
return Lname;
}
}
}