ListBox within TextBox / CodeCompletion

  • Thread starter Thread starter Ole
  • Start date Start date
O

Ole

Hello out there,
lang: csharp
topic: ListBox in RichTextBox / sql / db / editors

i am developing an sqlclientshellsystem, that makes it possible to
connect to various sqlservers ( ms sqlserver, oracle, db2, ... ).
Basic functionality is completed.
Now i want to implement wordcompletion for different things:
for example, if a user types in a tablename in order to specifiy the
columns,
i want to suggest the columns to him in form of a listbox popping up
beneath the tablename. ( like it is known in many IDEs (
Codecompletion or Intellisense ).

I know that i have to maintain keword database, schema information and
a like.

The problem is, how do i put a listbox into a textbox ??
i tried to TextBox.Controls.Add( ListBox ), but it doesn't have the
wanted effect.

Any hints ? ( I'm relatively new to .NET and haven't studied the
ComponentModel yet, but perhaps you might tell me how i can accomplish
my task )

Greetings and thanks in advance.

Ole Viaud-Murat
 
i found what i was looking for:
it's really trivial ... as an acquaintant said, you only have to
generate a new Form with FormBorderStyle = FormBorderStyle.None and
put a listbox to this new form. Then put the form under the current
cursor position of the TextBox.

But question follows:
how do i convert to position of the current insert caret of
a textbox to a System.Drawing.Point ?

i thought of

int ix = textbox.SelectionStart;
Point location = somehowconverttoPoint( ix, textbox );

thanks in advance.
 
I hope it doesn't seem that i am talking to myself,
but i must answer my silly question about the Caret to Point conversion.
RTFM!!

Point caretPoint = RichTextBox.GetPosFromCharIndex( currentIndex )


is the answer

Thanks either
 
Back
Top