Results 1 to 10 of 10

Thread: How to hide empty column ??

  1. #1

    Thread Starter
    Addicted Member
    Join Date
    Sep 2002
    Posts
    137

    Question How to hide empty column ??

    Hi all

    I have DBGrid table contains four columns, some of these columns empty, What I like to do is, when I make search by item number I saw four columns, either these columns empty or full, this is right, but I do not like to see empty columns, even when I do search ,I do not know which columns are empty or full.

    So, how I can write code to hide the empty columns.

    Any help will be appreciated

    Many Thanks in advance

  2. #2
    Hyperactive Member Simon Caiger's Avatar
    Join Date
    Aug 2000
    Location
    Rugby, England
    Posts
    377
    Make them zero width?
    Simon Caiger

    Documentation is like sex; when it's good, it's very, very good, and when it's bad, it's better than nothing.

  3. #3

    Thread Starter
    Addicted Member
    Join Date
    Sep 2002
    Posts
    137
    Thank you

    But, I like to put condition

    Example: I like to say if any one of these columns, column2 or column3 or column4 are empty then hide it or hide them.


    Any help in that plz?

    Thank you








    Originally posted by Simon Caiger
    Make them zero width?

  4. #4
    Hyperactive Member Simon Caiger's Avatar
    Join Date
    Aug 2000
    Location
    Rugby, England
    Posts
    377
    If I understand you correctly,

    Just make the column(s) that is/are empty, zero width.

    So if columns 2 and 4 are empty, make them zero width and leave the other columns in the grid at normal width.

    You could resize the visible columns to keep the grid the same overall size if you want.
    Simon Caiger

    Documentation is like sex; when it's good, it's very, very good, and when it's bad, it's better than nothing.

  5. #5
    Frenzied Member DeadEyes's Avatar
    Join Date
    Jul 2002
    Posts
    1,196
    vbnt are you getting the feeling of de-ja-vu?

  6. #6

    Thread Starter
    Addicted Member
    Join Date
    Sep 2002
    Posts
    137
    Many thanks for follow up Simon Caiger

    What you have just said is right, but , when I search I did not know which of these columns are or is empty, that is the reason I need if statement to control them , if there is empty column or columns .

    what really you said 100 % correct if I know the empty columns , but in the search time I do not know which is empty

    I hope you get what I mean .

    Thank you

    Originally posted by Simon Caiger
    If I understand you correctly,

    Just make the column(s) that is/are empty, zero width.

    So if columns 2 and 4 are empty, make them zero width and leave the other columns in the grid at normal width.

    You could resize the visible columns to keep the grid the same overall size if you want.

  7. #7
    Hyperactive Member Simon Caiger's Avatar
    Join Date
    Aug 2000
    Location
    Rugby, England
    Posts
    377
    OK, I'm with you now (I hope).

    Sorry I didn't fully understand your question to start with

    Where is the column data held before it is displayed?

    Is there any way you can process the data in the background before you display it and decide what columns will need to be visible?
    Simon Caiger

    Documentation is like sex; when it's good, it's very, very good, and when it's bad, it's better than nothing.

  8. #8

    Thread Starter
    Addicted Member
    Join Date
    Sep 2002
    Posts
    137
    Thank you
    I have database has many tables one of them has many columns,
    in these columns there are four columns need to be fill of the items for some reason some of these columns need to be empty, what I mean is , some times I fill one column ,sometimes 2 , some times 3 some times 4 , for that reason some columns became empty , that Is why I wanna put code to conrol them all .

    Is it clear idea now for you please ?



    Originally posted by Simon Caiger
    OK, I'm with you now (I hope).

    Sorry I didn't fully understand your question to start with

    Where is the column data held before it is displayed?

    Is there any way you can process the data in the background before you display it and decide what columns will need to be visible?

  9. #9
    Hyperactive Member Simon Caiger's Avatar
    Join Date
    Aug 2000
    Location
    Rugby, England
    Posts
    377
    OK,
    I did something similar to this getting data from a database once before.

    I had a number of tables in the db with columns for date, time, data1, data2 etc.
    What I wanted to do was sort the data before displaying it in a grid.
    So, what I did was read the data into zero width (hidden) columns in the grid and then, when I had finished reading the database, transfer the data from the hidden columns to the visible columns.

    In your case, after you have finished reading the db, you will see that some of the hidden columns are empty. Therefore you would make the corresponding (normally visible) column invisible also.

    If you have a lot of data to read and sort, you could display a progress bar or some sort of file loading .ani
    Simon Caiger

    Documentation is like sex; when it's good, it's very, very good, and when it's bad, it's better than nothing.

  10. #10

    Thread Starter
    Addicted Member
    Join Date
    Sep 2002
    Posts
    137
    Many thanks

    I will try to apply that, but if you send me some database example ,it will be much better.

    Thank you so much


    Originally posted by Simon Caiger
    OK,
    I did something similar to this getting data from a database once before.

    I had a number of tables in the db with columns for date, time, data1, data2 etc.
    What I wanted to do was sort the data before displaying it in a grid.
    So, what I did was read the data into zero width (hidden) columns in the grid and then, when I had finished reading the database, transfer the data from the hidden columns to the visible columns.

    In your case, after you have finished reading the db, you will see that some of the hidden columns are empty. Therefore you would make the corresponding (normally visible) column invisible also.

    If you have a lot of data to read and sort, you could display a progress bar or some sort of file loading .ani

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width