realbasic-nug
[Top] [All Lists]

Re: Why am I getting 2 copies when I do an f.show

To: REALbasic NUG <realbasic-nug at lists dot realsoftware dot com>
Subject: Re: Why am I getting 2 copies when I do an f.show
From: Charles Yeomans <yeomans at desuetude dot com>
Date: Mon, 29 Nov 2004 17:33:43 -0500
Delivered-to: realbasic-nug at lists dot realsoftware dot com
References: <200411292222 dot iATMMggu020434 at mac dot com>

On Nov 29, 2004, at 5:23 PM, Steve Smith wrote:

I have a form that launches another form with f.show.

For some reason, I'm getting two copies of the form shown. One that has the
correct data loaded in the open event, and one that's blank.

Is there something in this code in the open event that's causing another
instance to be shown?

  dim db as ODBCdatabase
  dim rs as recordSet
  dim sqlstr as string
  dim lp as integer
  db = new ODBCDatabase
  db.DataSource = "DRIVER={SQL Server};SERVER=192.168.0.2;Database=MX"
  if db.connect then
sqlstr = "Select * from CUSTOMER where lastname = '" + me.selectval +
"'"
    rs = db.SQLSelect (sqlstr)
    rs.movefirst
    winselect.lstnames.columnCount=5
    while not rs.eof
      winselect.lstnames.addRow rs.idxField(1).Value
      lp = winselect.lstnames.lastindex
      winselect.lstnames.cell(lp,1) = rs.idxfield(2).value
      winselect.lstnames.cell(lp,2) = rs.idxfield(3).value
      winselect.lstnames.cell(lp,3) = rs.idxfield(4).value
      rs.movenext
    wend
  else
    msgbox "connect Failed"
  end if


I don't see anything; if there were such code in the Open event, I would think that the result would be an unending sequence of windows opening. So probably the problem lies in the code that calls f.Show. Perhaps you're referring to the Rb-supplied instance of a window (as in Window1.DoSomething instead of w.DoSomething).

Charles Yeomans

_______________________________________________
Unsubscribe or switch delivery mode:
<http://www.realsoftware.com/support/listmanager/>

Search the archives of this list here:
<http://support.realsoftware.com/listarchives/lists.html>

<Prev in Thread] Current Thread [Next in Thread>