Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

calling a method from child form

Posted on 2004-04-22
5
Medium Priority
?
221 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 189 total points
ID: 10896700
0
 
LVL 8

Assisted Solution

by:rajaloysious
rajaloysious earned 186 total points
ID: 10899453
use this.Parent.......
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

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!
Calculating holidays and working days is a function that is often needed yet it is not one found within the Framework. This article presents one approach to building a working-day calculator for use in .NET.
Sometimes it takes a new vantage point, apart from our everyday security practices, to truly see our Active Directory (AD) vulnerabilities. We get used to implementing the same techniques and checking the same areas for a breach. This pattern can re…
In this video, Percona Solutions Engineer Barrett Chambers discusses some of the basic syntax differences between MySQL and MongoDB. To learn more check out our webinar on MongoDB administration for MySQL DBA: https://www.percona.com/resources/we…

688 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