TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Forums
Monthly Leaders
Forum guidelines
Lm Martiness
NA
107
8.1k
How to fill class with data c#
Jun 14 2020 5:05 AM
Hi everyone. I am trying to fill class with data and use these data anywhere else on the program, where i Will need it.
I created this class
public
class
id
{
private
string
name;
// field
public
string
Name
// property
{
get
{
return
name; }
// get method
set
{ name = value; }
// set method
}
}
And in form_name i tried to fill the class on this way:
private
void
Button_Click(
object
sender, RoutedEventArgs e)
{
id IDOBJE =
new
id();
{
IDOBJE.Name = txtshenimi.Text;
}
this
.Close();
}
}
And in another form i tried to retrieve data like this:
private
void
Button_Click_1(
object
sender, RoutedEventArgs e)
{
id idobje =
new
id();
txtrez.Text = idobje.Name;
}
But I don't get any result. Could someone help me to clarify this, cause i am new to OOP, and don't know so much about classes, and objects.
Reply
Answers (
2
)
Error When trying to publish asp.net project
I want DataGridview details to be exported as Word file.