?
Solved

form1 & form2   Refresh control

Posted on 2008-09-29
9
Medium Priority
?
605 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
  • 3
  • 2
  • +1
9 Comments
 
LVL 23

Expert Comment

by:Christopher Kile
ID: 22601255
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
ID: 22601270
To the moderators:

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

Expert Comment

by:Mike Tomlinson
ID: 22601314
Looks like C# to me...

Anyhoo, can't you do this?

    form2  _frm2 = new form2(StudentID);
    _frm2.showDialog()
    Txtbox_DoubleClick(null, null)
0
NFR key for Veeam Agent for Linux

Veeam is happy to provide a free NFR license for one year.  It allows for the non‑production use and valid for five workstations and two servers. Veeam Agent for Linux is a simple backup tool for your Linux installations, both on‑premises and in the public cloud.

 
LVL 18

Expert Comment

by:Priest04
ID: 22601360
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
 
LVL 18

Accepted Solution

by:
Priest04 earned 2000 total points
ID: 22601367
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
ID: 22601479
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
ID: 22601481
how do i assign the  Text box value  entered in form2  to the  Property LatestData in Form2....  
0
 

Author Comment

by:dotnet0824
ID: 22601711
Thanks a lot priest
0
 
LVL 18

Expert Comment

by:Priest04
ID: 22601850
You are welcome.
0

Featured Post

On Demand Webinar: Networking for the Cloud Era

Did you know SD-WANs can improve network connectivity? Check out this webinar to learn how an SD-WAN simplified, one-click tool can help you migrate and manage data in the cloud.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Wouldn’t it be nice if you could test whether an element is contained in an array by using a Contains method just like the one available on List objects? Wouldn’t it be good if you could write code like this? (CODE) In .NET 3.5, this is possible…
Real-time is more about the business, not the technology. In day-to-day life, to make real-time decisions like buying or investing, business needs the latest information(e.g. Gold Rate/Stock Rate). Unlike traditional days, you need not wait for a fe…
Monitoring a network: how to monitor network services and why? Michael Kulchisky, MCSE, MCSA, MCP, VTSP, VSP, CCSP outlines the philosophy behind service monitoring and why a handshake validation is critical in network monitoring. Software utilized …
How to fix incompatible JVM issue while installing Eclipse While installing Eclipse in windows, got one error like above and unable to proceed with the installation. This video describes how to successfully install Eclipse. How to solve incompa…
Suggested Courses

765 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