Solved

form1 & form2   Refresh control

Posted on 2008-09-29
9
596 Views
Last Modified: 2013-12-17
(WINDOW|S FORM)

I have form1 Textbox Control
In the doubleClick Event the control is populated with database result.
I have dataReader which loops. On buttonclick I openup form2

private void Txtbox_DoubleClick(object sender,EventArgs e)
  while dr.Read
      Txtbox.text += dr("name").tostring();

button_click

form2  _frm2 = new form2(StudentID);
_frm2.showDialog()
In form2 I have Textbox
I insert value into Customer Table for the StudentID passed in

On buton click I have to close the form2 and REFRESH form1 to populate the Textbox with the latest data
0
Comment
Question by:dotnet0824
  • 3
  • 3
  • 2
  • +1
9 Comments
 
LVL 23

Expert Comment

by:Christopher Kile
Comment Utility
I understand English may not be your first language; still, your explanation is very difficult to read, and the fact that you are giving us incomplete functions doesn't help at all.  Can you please attach all your current source code for this as a code snippet?  Thanks.

BTW, is this a homework assignment?
0
 
LVL 23

Expert Comment

by:Christopher Kile
Comment Utility
To the moderators:

Again, this is grossly misclassified - this is very specifically a Visual Basic.NET problem, not a general .NET problem.
0
 
LVL 85

Expert Comment

by:Mike Tomlinson
Comment Utility
Looks like C# to me...

Anyhoo, can't you do this?

    form2  _frm2 = new form2(StudentID);
    _frm2.showDialog()
    Txtbox_DoubleClick(null, null)
0
 
LVL 18

Expert Comment

by:Priest04
Comment Utility
Form2 should have some public property that will hold data latest value. This value you can access in Txtbox_DoubleClick. Ex

Goran
'Form2 code

Public ReadOnly Property LatestData() As String

    Get

        ' _latestData is the value that you want to pass to form1.

        ' Its value should be set before you close the form

        Return _latestData 

    End Get

End Property
 

' Form1 Txtbox_DoubleClick event code to add

form2  _frm2 = new form2(StudentID);

_frm2.showDialog()

' here we get the data from form2

Txtbox.text = frm2.LatestData

Open in new window

0
What Should I Do With This Threat Intelligence?

Are you wondering if you actually need threat intelligence? The answer is yes. We explain the basics for creating useful threat intelligence.

 
LVL 18

Accepted Solution

by:
Priest04 earned 500 total points
Comment Utility
pardon, I first thought that you have posted question only in VB zone. Here is the c# code


string _latestData;
 

// Form2 property

public string LatestData

{

    // _latestData is the value that you want to pass to form1.

    // Its value should be set before you close the form

    get{return _latestData;} // _latestData is the value that you want to pass to form1

}
 
 

' Form1 Txtbox_DoubleClick event code to add

form2  _frm2 = new form2(StudentID);

_frm2.showDialog()

' here we get the data from form2

Txtbox.Text = frm2.LatestData;

Open in new window

0
 
LVL 23

Expert Comment

by:Christopher Kile
Comment Utility
LMAO you're right...I was in the Visual Basic.NET area, and had encountered more than one misclassified question...this is C#, why was it in Visual Basic.NET?  *goes to clean contact lenses*
0
 

Author Comment

by:dotnet0824
Comment Utility
how do i assign the  Text box value  entered in form2  to the  Property LatestData in Form2....  
0
 

Author Comment

by:dotnet0824
Comment Utility
Thanks a lot priest
0
 
LVL 18

Expert Comment

by:Priest04
Comment Utility
You are welcome.
0

Featured Post

What Should I Do With This Threat Intelligence?

Are you wondering if you actually need threat intelligence? The answer is yes. We explain the basics for creating useful threat intelligence.

Join & Write a Comment

Many of us here at EE write code. Many of us write exceptional code; just as many of us write exception-prone code. As we all should know, exceptions are a mechanism for handling errors which are typically out of our control. From database errors, t…
If you need to start windows update installation remotely or as a scheduled task you will find this very helpful.
Internet Business Fax to Email Made Easy - With eFax Corporate (http://www.enterprise.efax.com), you'll receive a dedicated online fax number, which is used the same way as a typical analog fax number. You'll receive secure faxes in your email, fr…
This video explains how to create simple products associated to Magento configurable product and offers fast way of their generation with Store Manager for Magento tool.

771 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

10 Experts available now in Live!

Get 1:1 Help Now