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....
29 5678
Hi,
If you want only for Check Box, you can very well use MSFlexGrid only..
Regards
Veena
To. Ms Veena,
for msflexgrid, will the item data editable?
and how to put a checkbox with msflexgrid?
thanks in advance..
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: -
Dim i As Integer
-
For i = 1 To Grd.Rows-1
-
Grd.Row =i
-
Grd.Col=4
-
Grd.CellFontname ="Marlett"
-
Next
-
Write this code in Grd_Click Event: -
If Grd.Row >0 And Grd.Col=4 Then
-
If Trim(Grd.Text) = "" Then
-
Grd.Text ="b"
-
Else
-
Grd.Text = ""
-
End If
-
End If
-
And In Save/Print Button, Loop thru the Rows, and Check For -
If Trim(Grd.TextMatrix(2,4)) ="b" Then
-
MsgBox "Row 2 Selected"
-
Else
-
MsgBox "Row 2 Not Selected"
-
End If
-
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
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 .. =)
What does the UBGrid looks like? Is it the same as FlexGrid? I never encountered this control before : )
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
=)
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 : )
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
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.. =)
Good day,
I'm downloading UBGrid but i don't know how to use it.. can anyone help me?
Better Than Yesterday (-.-)
Dear Ms. Veena and other experts,
I was trying to save the content of Msflexgrid for all rows that have the "b" value. - If cboSales.Text = "" Then
-
MsgBox "Choose Sales No!"
-
Else
-
With rs
-
.ActiveConnection = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=salesdb.mdb;Persist Security Info=False"
-
.CursorLocation = adUseClient
-
.LockType = adLockOptimistic
-
.CursorType = adOpenStatic
-
.Source = "SELECT * FROM Sales"
-
.Open
-
-
For i = 1 To MSFlexGrid1.Rows - 2
-
If MSFlexGrid1.TextMatrix(i, 4) = "b" Then
-
If Not MSFlexGrid1.TextMatrix(i, 3) < 1 Then
-
.AddNew
-
.Fields(0).Value = txtNoSO.Text
-
.Fields(1).Value = cboSales.Text
-
.Fields(2).Value = dtDate.Value
-
.Fields(3).Value = cboCust.Text
-
.Fields(4).Value = MSFlexGrid1.TextMatrix(i, 0) 'item name
-
.Fields(5).Value = MSFlexGrid1.TextMatrix(i, 3) 'item qty
-
.Update
-
End If
-
Else
-
MsgBox "Please insert a valid qty!"
-
End If
-
Else
-
MsgBox "There's nothing to insert!"
-
End If
-
Next
-
End With
-
End If
I wonder why it only save the first row and then it show an error.
its kinda confusing me..
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
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.
Hi,
revert back to .Rows-2
Try this FOR Loop -
For i = 1 To MSFlexGrid1.Rows - 2
-
If MSFlexGrid1.TextMatrix(i, 4) = "b" And Val(MSFlexGrid1.TextMatrix(i, 3)) > 0 Then
-
.AddNew
-
.Fields(0).Value = txtNoSO.Text
-
.Fields(1).Value = cboSales.Text
-
.Fields(2).Value = dtDate.Value
-
.Fields(3).Value = cboCust.Text
-
.Fields(4).Value = MSFlexGrid1.TextMatrix(i, 0)
-
.Fields(5).Value = MSFlexGrid1.TextMatrix(i, 3)
-
.Update
-
End If
-
Next
-
How many rows are there in Grid..?
What is the PK of the table..?
Regards
Veena
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*
Hi,
What is the PK of Sales table...?
Regards
Veena
Hi,
What is the PK of Sales table...?
Regards
Veena
Forgive me, what PK is?
Forgive me, what PK is?
PK means "Primary Key"
PK means "Primary Key"
I see..
it's SO_No
it can be find at txtnoso.text
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
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".
Hi,
How many Columns your grid has..?
How have you declared variable "i"...?
Post your Table Structure..
Regards
Veena
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
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. - If cboSales.Text = "" Then
-
MsgBox "Choose Sales No!"
-
Else
-
With rs
-
.ActiveConnection = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=salesdb.mdb;Persist Security Info=False"
-
.CursorLocation = adUseClient
-
.LockType = adLockOptimistic
-
.CursorType = adOpenStatic
-
.Source = "SELECT * FROM Sales"
-
.Open
-
-
For i = 1 To MSFlexGrid1.Rows - 2
-
-
If Not MSFlexGrid1.TextMatrix(i, 3) < 1 Then
-
.AddNew
-
.Fields(0).Value = txtNoSO.Text
-
.Fields(1).Value = cboSales.Text
-
.Fields(2).Value = dtDate.Value
-
.Fields(3).Value = cboCust.Text
-
.Fields(4).Value = MSFlexGrid1.TextMatrix(i, 0) 'item name
-
.Fields(5).Value = MSFlexGrid1.TextMatrix(i, 3) 'item qty
-
.Update
-
End If
-
Else
-
MsgBox "Please insert a valid qty!"
-
End If
-
-
Next
-
End With
-
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?
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
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).
Hi,
Change the checking to :
If Val(MSFlexGrid1.TextMatrix(i, 3)) > 0 Then
Regards
Veena
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?
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
Sign in to post your reply or Sign up for a free account.
Similar topics
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...
|
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,...
|
by: Charles Arthur |
last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
|
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...
|
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...
|
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...
|
by: nemocccc |
last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
|
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...
|
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...
|
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,...
| |