Solved

calling a method from child form

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

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

Question has a verified solution.

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

Introduction Hi all and welcome to my first article on Experts Exchange. A while ago, someone asked me if i could do some tutorials on object oriented programming. I decided to do them on C#. Now you may ask me, why's that? Well, one of the re…
The article shows the basic steps of integrating an HTML theme template into an ASP.NET MVC project
Finds all prime numbers in a range requested and places them in a public primes() array. I've demostrated a template size of 30 (2 * 3 * 5) but larger templates can be built such 210  (2 * 3 * 5 * 7) or 2310  (2 * 3 * 5 * 7 * 11). The larger templa…
In a recent question (https://www.experts-exchange.com/questions/29004105/Run-AutoHotkey-script-directly-from-Notepad.html) here at Experts Exchange, a member asked how to run an AutoHotkey script (.AHK) directly from Notepad++ (aka NPP). This video…

710 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