Query Output to viewable text

  • I have a question for any VB app developers out there to ponder. I am looking for a text control, or the property(ies) of an existing Microsoft control, that will allow a textbox to contain more than 1024 characters per line. Essentially what I have is an application that I have written to mimic the feel of Query Analyzer for an ORACLE database (because I hate SQL*Plus). The problem that I have run into is that if I want to output a select statement to a textbox, I will run into this textbox limitation if the table width exceeds around 1024 bytes (could be less depending on the number of columns in the table). I have also looked at using the Rich Text box, but the closest I have been able to get with that is outputting only one line (around 2500 characters wide) as wanted. The rest of the time I get wrap around even though I use MultiLine = True, Scrollbars = 3 (rtfBoth), and MaxLength = 0. Any help on this will be greatly appreciated.

  • Thats pretty interesting! We get some great questions on here, makes you realize how much there is to learn. Anyway, I can duplicate that behavior with the text box. I think you might could do some API calls to get the scroll bar without setting multi line to true, but dont know if that would help, or make a bigger mess. Another option would be to manage the display yourself, figure out what column you're in just display x chars to left and right depending on screen location of the caret. HTML control (embedded browser) might offer an option for displaying. Tried the grid controls?

    Still, why not do like the line continuation feature in VB, implement your own line wrapping, or just let it wrap as is? Not that is what you asked for!

    Andy

    http://www.sqlservercentral.com/columnists/awarren/

  • I use Flex Grid Control for similar things, but there are still huge limitations for this purpose. The reason I ended up using it was for the ability to turn on grid lines (simple formatting) to make it appear as either Grid or text (turn formatting off). It complicates and simplifies a lot of things at the same time. For instance, I use a row per line on the returned text. This makes it neccessary to keep track of line numbers, or grid rows if you rather, but also simplifies record counts, modifications (if editing is allowed), cut and paste (and makes it more difficult in text), and allows for individual formatting of lines (edited lines red, maybe), etc. I am exploring Div's and span's in HTML to overcome almost the same limitation as you though.

  • Thanks for the responses. I have briefly looked at setting up my own control in an attempt to get around this problem with the text box. What I was really hoping to get some info on (if anyone out there reading this knows), is the type of control Microsoft uses in the output pane of the Query Analyzer window. I have been able to duplicate the Grid portion of the control, but am now stuck on the text output.

    And before anyone comes back with the suggestion, "Why don't you just link the ORACLE server to SQL Server?", I will just let you know that it will be easier for me to just solve this problem than to open that can of worms with our server administrators. They are trying not to widely distribute the ORACLE ODBC drivers.

    Thanks again for any and all assistance.

  • Ok, the control that QA uses is one I am not familiar with. The class name is a "DimensionEdit" where as the base class name for a textbox is an "edit". To get these use spy++ that comes with visual studio. Please see its associtated find tool to look at a window on your desktop to find out information about it. IMHO spy++ is one of the most useful tools to come with visual studio besides the IDE's and should be a part of every developers bag of tricks... Hope this helps you, I am going to see if I can find a way to implement this class. It might have to be wrapped in a C++ ATL class for VB to use it, if it does not support the proper interfaces.

    Tim C.

    //Will write code for food

    One Windows to rule them all, One Windows to find them,

    One Windows to bring them all and in the darkness bind them

    In the Land of Microsoft where the Shadows lie.


    Tim C //Will code for food

  • Having an interesting time trying to implement this control in VB. Probably need someone with more API knowledge than I to work on it. Useing RegisterClass, and CreateWindowEx I was able to get the window to create and be placed on a form, but I am getting a memory exception error (I love these in VB). And the window is not editable while running. There is some style or extended style I am missing, or I am not properly dispatching the messages back out from my hook proc, or something. There IS NO documentation out there on this window at all, cept for some Japanese articles, and my Nihongo is VERY rusty. Plus I never got any good at reading it either. There is one extended style that Spy++ does not recognize and neither can I find it either. I am going to give up at this point, but if anyone wishes I will send them a zipped version of the crappy little test harness source that I have made so far. Sorry I was not more help.... Email me if you want the source...

    Tim C.

    //Will write code for food

    One Windows to rule them all, One Windows to find them,

    One Windows to bring them all and in the darkness bind them

    In the Land of Microsoft where the Shadows lie.


    Tim C //Will code for food

Viewing 6 posts - 1 through 5 (of 5 total)

You must be logged in to reply to this topic. Login to reply