Solved

calling a method from child form

Posted on 2004-04-22
5
207 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
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

Do You Know the 4 Main Threat Actor Types?

Do you know the main threat actor types? Most attackers fall into one of four categories, each with their own favored tactics, techniques, and procedures.

Join & Write a Comment

Introduction                                                 Was the var keyword really only brought out to shorten your syntax? Or have the VB language guys got their way in C#? What type of variable is it? All will be revealed.   Also called…
Entity Framework is a powerful tool to help you interact with the DataBase but still doesn't help much when we have a Stored Procedure that returns more than one resultset. The solution takes some of out-of-the-box thinking; read on!
Access reports are powerful and flexible. Learn how to create a query and then a grouped report using the wizard. Modify the report design after the wizard is done to make it look better. There will be another video to explain how to put the final p…
Polish reports in Access so they look terrific. Take yourself to another level. Equations, Back Color, Alternate Back Color. Write easy VBA Code. Tighten space to use less pages. Launch report from a menu, considering criteria only when it is filled…

707 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

14 Experts available now in Live!

Get 1:1 Help Now