Solved

calling a method from child form

Posted on 2004-04-22
5
219 Views
Last Modified: 2010-05-18
Dear friends,

I have a child form called frmNameApproal opned. When I click toolbar button from the parent form, it generates a approval number and it should display in the textbox of the active mdi child form called frmNameApproval. But the txtapprovalno is not showing the approval number that the nextcode function returns. Can anybody help please?

Rgds,

Naf

public void doaction(int index)
        {
            if (index==0)
            {
                clsApproval app=new clsApproval();
                this.txtapprovalno.Text =app.nextcode();
            }
            else if (index==1)
            {

            }
-------
-------

The nextcode() method is written in clsApproval class as follows;

public string nextcode()
        {
            try
            {
                int temp=0;
                OleDbCommand mycommand=new OleDbCommand("select lapprovalno from tblcompanyprofile",clslogin.conn);
                OleDbDataReader myreader;
                myreader=mycommand.ExecuteReader();
                while(myreader.Read())
                {
                    temp=Int32.Parse(myreader.GetValue(0).ToString());  
                    if (temp!=0)
                    {
                        temp+=1;
                    }
                    else
                    {
                        temp= 1;
                    }
                }
                myreader.Close();
                return "N/A" + temp.ToString();
               
            }
            catch(Exception e)
            {
                return e.ToString();
            }
        }



0
Comment
Question by:nafli
[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
5 Comments
 
LVL 21

Expert Comment

by:tovvenki
ID: 10896234
Hi,
where have you(in which form) written the doaction(int index) method?

venki
0
 
LVL 23

Accepted Solution

by:
rama_krishna580 earned 63 total points
ID: 10896700
0
 
LVL 8

Assisted Solution

by:rajaloysious
rajaloysious earned 62 total points
ID: 10899453
use this.Parent.......
0

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

Article by: Ivo
C# And Nullable Types Since 2.0 C# has Nullable(T) Generic Structure. The idea behind is to allow value type objects to have null values just like reference types have. This concerns scenarios where not all data sources have values (like a databa…
Summary: Persistence is the capability of an application to store the state of objects and recover it when necessary. This article compares the two common types of serialization in aspects of data access, readability, and runtime cost. A ready-to…
Monitoring a network: why having a policy is the best policy? Michael Kulchisky, MCSE, MCSA, MCP, VTSP, VSP, CCSP outlines the enormous benefits of having a policy-based approach when monitoring medium and large networks. Software utilized in this v…
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 …
Suggested Courses

617 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