New topic: 

AutoFIll

<http://forums.realsoftware.com/viewtopic.php?t=37950>

         Page 1 of 1
   [ 2 posts ]                 Previous topic | Next topic          Author  
Message        john98335          Post subject: AutoFIllPosted: Fri Mar 04, 
2011 7:30 pm                         
Joined: Fri Mar 04, 2011 7:08 pm
Posts: 1                I am trying to populate cells in a listbox by typing in 
the first letter or two of the value and matching them to an string with the 
full text of the values. In the application, the string is a global variable 
assigned values elsewhere. The following code was typed into the Cell Key Down 
function. It works perfectly up until the line that assigns the value to the 
active cell (ListBox1.Cell(row,column)=cv). Any suggestions as to how to get it 
to work? By the way, it works if I put it into the CellLostFocus function but 
the user does not know in advance if there is a match.

  Dim i,r,x,y As Integer
  Dim cv,k,m,t As String
  k=cell(row,column)+key
  r=Len(k)
  m=LabelString
  x=0
  For i=1 to 50
  t=NthField(m,”,”,i)
  If Left(t,r)=Left(k,r) Then
   cv=k2
   x=x+1
  End
  Next
  If x=1 Then //Ensures that the cell values match a single value in the string
   Listbox1.Cell(row,column)=cv
  End
  Return True   
                             Top                 timhare          Post subject: 
Re: AutoFIllPosted: Fri Mar 04, 2011 7:51 pm                         
Joined: Fri Jan 06, 2006 3:21 pm
Posts: 9386
Location: Portland, OR  USA                You must also set the value of 
ActiveCell.Text.

And since this code is in a listbox event, use "me" instead of "listbox1".  It 
makes your code more portable and less fragile.
Code:If x=1 Then //Ensures that the cell values match a single value in the 
string
 me.Cell(row,column) = cv
 me.ActiveCell.Text = cv
End
   
                             Top             Display posts from previous: All 
posts1 day7 days2 weeks1 month3 months6 months1 year Sort by AuthorPost 
timeSubject AscendingDescending          Page 1 of 1
   [ 2 posts ]      
-- 
Over 1500 classes with 29000 functions in one REALbasic plug-in collection. 
The Monkeybread Software Realbasic Plugin v9.3. 
http://www.monkeybreadsoftware.de/realbasic/plugins.shtml

[email protected]

Reply via email to