473,387 Members | 3,801 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

UBGrid

Hi there..
I just wondering are there anyone ever use UBGrid?
it's a standalone program for VB 6.0 that can add checkbox to the grid.


Thanks....
Jan 10 '08 #1
29 5678
QVeen72
1,445 Expert 1GB
Hi,

If you want only for Check Box, you can very well use MSFlexGrid only..

Regards
Veena
Jan 10 '08 #2
To. Ms Veena,
for msflexgrid, will the item data editable?
and how to put a checkbox with msflexgrid?

thanks in advance..
Jan 10 '08 #3
QVeen72
1,445 Expert 1GB
Hi,

There is one Simple Way , To make a Column Check box in MSFlexGrid..

Say, you want to make Column 4 as Selection Column.
FontName Marlett has character "b" looking like a Check-Mark Icon.
What you can do is Set whole of the column name = "Marlett", and In Click-event Toggle between "b" and empty...To Chaneg Font of whole column, write this Code after populating the Grid:
Expand|Select|Wrap|Line Numbers
  1. Dim i As Integer 
  2. For i = 1 To Grd.Rows-1 
  3.     Grd.Row =i 
  4.     Grd.Col=4 
  5.     Grd.CellFontname ="Marlett" 
  6. Next 
  7.  
Write this code in Grd_Click Event:

Expand|Select|Wrap|Line Numbers
  1. If Grd.Row >0 And Grd.Col=4 Then 
  2.     If Trim(Grd.Text) = "" Then 
  3.         Grd.Text ="b" 
  4.     Else 
  5.         Grd.Text = "" 
  6.     End If 
  7. End If 
  8.  
And In Save/Print Button, Loop thru the Rows, and Check For
Expand|Select|Wrap|Line Numbers
  1. If Trim(Grd.TextMatrix(2,4)) ="b"  Then
  2.     MsgBox "Row 2 Selected"
  3. Else
  4.    MsgBox "Row 2 Not Selected"
  5. End If
  6.  
It will indicate Selected Row.
This Logic works fine for me..
Alternatively, Webdings font has also got font "a" looking like a Check Mark..
you can use Either..

If you search the Web, many people suggest you to use an Icon or Picture of a Check Mark and load /Remove the Image from the FlexGrid Cell. this is too tedious.

Regards
Veena
Jan 10 '08 #4
Dear Ms.Veena,
you really rocks...!!
it's working, although there's no change to the cell font, it still ms sans serif, but that's ok, maybe im gonna use "Yes" as a check mark.
But sadly i cant edit data value of msflexgrid,
i wonder why there's no "AllowUpdate" properties as in DataGrid.

But thanks so much for your help!!
If only i could do something for you in return .. =)
Jan 10 '08 #5
lotus18
866 512MB
What does the UBGrid looks like? Is it the same as FlexGrid? I never encountered this control before : )
Jan 10 '08 #6
Dear lotus18,

yep it just like other's grid..
but it can put checkbox, combobox, etc inside the grid..

but i dont know how to use it though,
just found it on google search
=)
Jan 10 '08 #7
lotus18
866 512MB
Dear lotus18,

yep it just like other's grid..
but it can put checkbox, combobox, etc inside the grid..

but i dont know how to use it though,
just found it on google search
=)
Wow

It sounds amazing. I'll try that grid later : )
Jan 10 '08 #8
QVeen72
1,445 Expert 1GB
Dear Ms.Veena,
you really rocks...!!
it's working, although there's no change to the cell font, it still ms sans serif, but that's ok, maybe im gonna use "Yes" as a check mark.
But sadly i cant edit data value of msflexgrid,
i wonder why there's no "AllowUpdate" properties as in DataGrid.

But thanks so much for your help!!
If only i could do something for you in return .. =)
Hi,

Glad, it could help you.
If you really want a Robust Editable Grid, then go for VSFlexGrid.
Its really cool, and you can set all the Properties @ Design Time (like Say Column Width, Row Height, ) and Column Property like CheckBox/Combo/Button/TextBox..etc..

Regards
Veena
Jan 10 '08 #9
Hi,

Glad, it could help you.
If you really want a Robust Editable Grid, then go for VSFlexGrid.
Its really cool, and you can set all the Properties @ Design Time (like Say Column Width, Row Height, ) and Column Property like CheckBox/Combo/Button/TextBox..etc..

Regards
Veena
That's ok, i've found a way to edit the data value from msflexgrid.
Thanks so much for your help.. =)
Jan 10 '08 #10
werks
220 100+
Good day,

I'm downloading UBGrid but i don't know how to use it.. can anyone help me?


Better Than Yesterday (-.-)
Jan 10 '08 #11
Dear Ms. Veena and other experts,
I was trying to save the content of Msflexgrid for all rows that have the "b" value.

Expand|Select|Wrap|Line Numbers
  1. If cboSales.Text = "" Then
  2.         MsgBox "Choose Sales No!"
  3.     Else 
  4.     With rs
  5.         .ActiveConnection = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=salesdb.mdb;Persist Security Info=False"
  6.         .CursorLocation = adUseClient
  7.         .LockType = adLockOptimistic
  8.         .CursorType = adOpenStatic
  9.         .Source = "SELECT * FROM Sales"
  10.         .Open
  11.  
  12.                     For i = 1 To MSFlexGrid1.Rows - 2
  13.                             If MSFlexGrid1.TextMatrix(i, 4) = "b" Then
  14.                                 If Not MSFlexGrid1.TextMatrix(i, 3) < 1 Then
  15.                                      .AddNew
  16.                                      .Fields(0).Value = txtNoSO.Text
  17.                                      .Fields(1).Value = cboSales.Text
  18.                                      .Fields(2).Value = dtDate.Value
  19.                                      .Fields(3).Value = cboCust.Text
  20.                                      .Fields(4).Value = MSFlexGrid1.TextMatrix(i, 0) 'item name
  21.                                      .Fields(5).Value = MSFlexGrid1.TextMatrix(i, 3) 'item qty
  22.                                      .Update                
  23.                                   End If
  24.                                 Else
  25.                                     MsgBox "Please insert a valid qty!"
  26.                                 End If
  27.                             Else
  28.                                 MsgBox "There's nothing to insert!"
  29.                             End If
  30.                Next
  31. End With
  32. End If
I wonder why it only save the first row and then it show an error.
its kinda confusing me..
Jan 12 '08 #12
QVeen72
1,445 Expert 1GB
Hi,


Try to change your second IF to :

If Val(MSFlexGrid1.TextMatrix(i, 3)) > 0 Then

Not very sure of the Fields, Use Val( ) Wherever, you are trying to save a Numeric expression, Open the Recordset as Dynamic, instead of Static,
and change the For Loop to :

For i = 1 To MSFlexGrid.Rows-1

Regards
Veena
Jan 13 '08 #13
I've made a changed and it still show an error "Subscript out of range".
When i pressed on debug button,
it highlighted this part.

If MSFlexGrid1.TextMatrix(i, 4) = "b" Then

and still only the first row's item being saved.
Jan 13 '08 #14
QVeen72
1,445 Expert 1GB
Hi,

revert back to .Rows-2

Try this FOR Loop

Expand|Select|Wrap|Line Numbers
  1. For i = 1 To MSFlexGrid1.Rows - 2
  2.     If MSFlexGrid1.TextMatrix(i, 4) = "b" And Val(MSFlexGrid1.TextMatrix(i, 3)) > 0 Then
  3.               .AddNew
  4.               .Fields(0).Value = txtNoSO.Text
  5.               .Fields(1).Value = cboSales.Text
  6.               .Fields(2).Value = dtDate.Value
  7.               .Fields(3).Value = cboCust.Text
  8.               .Fields(4).Value = MSFlexGrid1.TextMatrix(i, 0) 
  9.               .Fields(5).Value = MSFlexGrid1.TextMatrix(i, 3) 
  10.               .Update                
  11.     End If
  12. Next
  13.  
How many rows are there in Grid..?
What is the PK of the table..?

Regards
Veena
Jan 13 '08 #15

How many rows are there in Grid..?
What is the PK of the table..?
There are 5 rows in the grid.
And as for note when the grid consist of 1 item data only (then it become 1 row only), the script works very well.
It will show "subscript out of range" when there are more than 1 itemdata (row).

I've tried the code and it still save first row itemdata only (while there are 5 itemdata) *sad*
Jan 13 '08 #16
QVeen72
1,445 Expert 1GB
Hi,

What is the PK of Sales table...?

Regards
Veena
Jan 14 '08 #17
Hi,

What is the PK of Sales table...?

Regards
Veena
Forgive me, what PK is?
Jan 14 '08 #18
lotus18
866 512MB
Forgive me, what PK is?
PK means "Primary Key"
Jan 14 '08 #19
PK means "Primary Key"
I see..
it's SO_No
it can be find at txtnoso.text
Jan 14 '08 #20
QVeen72
1,445 Expert 1GB
Hi,

Thats your answer..
Your table has PrimaryKey ..
PK cannot be repeated,
and you are putting in a loop and try to add, the same PK.
obviously, it doesnt add..you will get error

Either Make a Composite PK , or else, remove PK and make some other field as PK..

In such conditions, (SalesNo + SlNo ) together will be the PK..

REgards
Veena
Jan 14 '08 #21
Dear Ms. Veena,
i've remove PK from Sales table, and i dont use any PK for now.
but when i run the program it still has the same problem.
it only save the first row item data and then "subscript out of range".
Jan 14 '08 #22
QVeen72
1,445 Expert 1GB
Hi,

How many Columns your grid has..?
How have you declared variable "i"...?
Post your Table Structure..


Regards
Veena
Jan 14 '08 #23
There are 4 columns in the grid.
Col:
1 -> Item's id
2 -> Item's name
3 -> Qty
4 -> "b" as checkbox

Yup i had declared "i" as integer.

Table structure:
1. SO_No
2. PO_No
3. Date
4. CustomerID
5. ItemID
6. Qty
Jan 14 '08 #24
it's to complicated, isnt it? =(
i've tried to change the validation so it will be : only save the cols(3) that is not NULL.

Expand|Select|Wrap|Line Numbers
  1. If cboSales.Text = "" Then
  2.         MsgBox "Choose Sales No!"
  3.     Else 
  4.     With rs
  5.         .ActiveConnection = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=salesdb.mdb;Persist Security Info=False"
  6.         .CursorLocation = adUseClient
  7.         .LockType = adLockOptimistic
  8.         .CursorType = adOpenStatic
  9.         .Source = "SELECT * FROM Sales"
  10.         .Open
  11.  
  12.                     For i = 1 To MSFlexGrid1.Rows - 2
  13.  
  14.                                 If Not MSFlexGrid1.TextMatrix(i, 3) < 1 Then
  15.                                      .AddNew
  16.                                      .Fields(0).Value = txtNoSO.Text
  17.                                      .Fields(1).Value = cboSales.Text
  18.                                      .Fields(2).Value = dtDate.Value
  19.                                      .Fields(3).Value = cboCust.Text
  20.                                      .Fields(4).Value = MSFlexGrid1.TextMatrix(i, 0) 'item name
  21.                                      .Fields(5).Value = MSFlexGrid1.TextMatrix(i, 3) 'item qty
  22.                                      .Update                
  23.                                   End If
  24.                                 Else
  25.                                     MsgBox "Please insert a valid qty!"
  26.                                 End If
  27.  
  28.                Next
  29. End With
  30. End If
For that code, if cols(3) consists of NULL value then it will stop working, where there're still others value that is not null.

Did i make a wrong validation?
Jan 16 '08 #25
lotus18
866 512MB
it's to complicated, isnt it? =(
i've tried to change the validation so it will be : only save the cols(3) that is not NULL.

[code=vb]If cboSales.Text = "" Then
MsgBox "Choose Sales No!"
Exit Sub
Else
With rs
.
.
.
.
I had just added Exit Sub. : )

Rey Sean
Jan 16 '08 #26
I had just added Exit Sub. : )

Rey Sean
Dear Mr. Rey Sean,
Thanks for your reply, but it doesn't make any change, because what i want to validate is it msflexgrid of colums(3).
Jan 16 '08 #27
QVeen72
1,445 Expert 1GB
Hi,

Change the checking to :

If Val(MSFlexGrid1.TextMatrix(i, 3)) > 0 Then


Regards
Veena
Jan 16 '08 #28
Hi,

Change the checking to :

If Val(MSFlexGrid1.TextMatrix(i, 3)) > 0 Then


Regards
Veena
I've change it and it works but it only save 1 itemdata instead of 5.
Do i need to make a looping? but how?
Jan 16 '08 #29
QVeen72
1,445 Expert 1GB
Hi,

Keep a BreakPoint on first line and debug,
and check if it passes through the"IF" condition and goes to ".AddNew" ..
(For all 5 rows)
If it is not passing, then the Value of the Grid for that row, is Blank/NIL

If it is passing, then PK has not been removed..


Regards
Veena
Jan 16 '08 #30

Sign in to post your reply or Sign up for a free account.

Similar topics

4
by: mousi | last post by:
Hello, I use Visual Basic 6 to get some data from an Access database... What I want to do, is create a table in my form to put that data inside. But I want to be able to access the table's cells...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.