Solved

calling a method from child form

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

Technology Partners: 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

In order to hide the "ugly" records selectors (triangles) in the rowheaders, here are some suggestions. Microsoft doesn't have a direct method/property to do it. You can only hide the rowheader column. First solution, the easy way The first sol…
Introduction Although it is an old technology, serial ports are still being used by many hardware manufacturers. If you develop applications in C#, Microsoft .NET framework has SerialPort class to communicate with the serial ports.  I needed to…
Nobody understands Phishing better than an anti-spam company. That’s why we are providing Phishing Awareness Training to our customers. According to a report by Verizon, only 3% of targeted users report malicious emails to management. With compan…
Attackers love to prey on accounts that have privileges. Reducing privileged accounts and protecting privileged accounts therefore is paramount. Users, groups, and service accounts need to be protected to help protect the entire Active Directory …

679 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