|
-
Dec 30th, 2009, 03:30 AM
#1
Thread Starter
Addicted Member
run time error 380
"Invalid property value"
for show data in list view i write code
Code:
Private Sub Form_Load()
Dim i As Integer
Call path
SQL = "select * from material"
Set rs = New ADODB.Recordset
i = 1
rs.Open SQL, Adb, adOpenDynamic, adLockOptimistic
Do While Not rs.EOF
LVEmp.ListItems.Add i, , i
LVEmp.ListItems(i).SubItems(1) = rs!id
LVEmp.ListItems(i).SubItems(2) = rs!Name
LVEmp.ListItems(i).SubItems(3) = rs!unit
i = i + 1
rs.MoveNext
Loop
rs.Close
End Sub
when I run it then show this msg. and highlight this line
Code:
LVEmp.ListItems(i).SubItems(1) = rs!id
-
Dec 30th, 2009, 07:08 AM
#2
Re: run time error 380
Try
vb Code:
Dim i As Integer
Dim lvwItem As Listitem
Call Path
SQL = "select * from material"
Set rs = New ADODB.Recordset
i = 1
rs.Open SQL, Adb, adOpenDynamic, adLockOptimistic
Do While Not rs.EOF
Set lvwItem = LVEmp.ListItems.Add(i, , i)
lvwItem.SubItems(1) = rs!id
lvwItem.SubItems(2) = rs!Name
lvwItem.SubItems(3) = rs!unit
i = i + 1
rs.MoveNext
Loop
rs.Close
End Sub
-
Jan 3rd, 2010, 06:18 AM
#3
Thread Starter
Addicted Member
Re: run time error 380
sorry. after try your code that msg again show.
-
Jan 3rd, 2010, 10:13 AM
#4
Re: run time error 380
What is the value of rs!id
Check it manually by inserting this one line before...
If the value is correct then try
Trim(rs!id) before setting it as a value....
A good exercise for the Heart is to bend down and help another up...
Please Mark your Thread " Resolved", if the query is solved
MyGear:
★ CPU ★ Ryzen 5 5800X
★ GPU ★ NVIDIA GeForce RTX 3080 TI Founder Edition
★ RAM ★ G. Skill Trident Z RGB 32GB 3600MHz
★ MB ★ ASUS TUF GAMING X570 (WI-FI) ATX Gaming
★ Storage ★ SSD SB-ROCKET-1TB + SEAGATE 2TB Barracuda IHD
★ Cooling ★ NOCTUA NH-D15 CHROMAX BLACK 140mm + 10 of Noctua NF-F12 PWM
★ PSU ★ ANTEC HCG-1000-EXTREME 1000 Watt 80 Plus Gold Fully Modular PSU
★ Case ★ LIAN LI PC-O11 DYNAMIC XL ROG (BLACK) (G99.O11DXL-X)
★ Monitor ★ LG Ultragear 27" 240Hz Gaming Monitor
★ Keyboard ★ TVS Electronics Gold Keyboard
★ Mouse ★ Logitech G502 Hero
-
Jan 3rd, 2010, 11:00 AM
#5
Hyperactive Member
Re: run time error 380
Try Add ColumnHeaders..
Code:
Private Sub Form_Load()
Dim i As Integer
Call path
SQL = "select * from material"
Set rs = New ADODB.Recordset
LVEmp.View = lvwReport
LVEmp.ColumnHeaders.Add , , "Count"
LVEmp.ColumnHeaders.Add , , "ID"
LVEmp.ColumnHeaders.Add , , "Name"
LVEmp.ColumnHeaders.Add , , "Unit"
i = 1
rs.Open SQL, Adb, adOpenDynamic, adLockOptimistic
Do While Not rs.EOF
LVEmp.ListItems.Add i, , i
LVEmp.ListItems(i).SubItems(1) = rs!id
LVEmp.ListItems(i).SubItems(2) = rs!Name
LVEmp.ListItems(i).SubItems(3) = rs!unit
i = i + 1
rs.MoveNext
Loop
rs.Close
End Sub
"More Heads are Better than One"
-
Jan 3rd, 2010, 09:41 PM
#6
Thread Starter
Addicted Member
Re: run time error 380
 Originally Posted by koolsid
What is the value of rs!id
Check it manually by inserting this one line before...
If the value is correct then try
Trim(rs!id) before setting it as a value....
it is manually insert. when I use your code msg show: 1. and then show that msg. if i use trim(rs!id) not solve.
-
Jan 4th, 2010, 02:12 AM
#7
Re: run time error 380
Abu, Can I see you project? If you want, you can also mail it to me...
A good exercise for the Heart is to bend down and help another up...
Please Mark your Thread " Resolved", if the query is solved
MyGear:
★ CPU ★ Ryzen 5 5800X
★ GPU ★ NVIDIA GeForce RTX 3080 TI Founder Edition
★ RAM ★ G. Skill Trident Z RGB 32GB 3600MHz
★ MB ★ ASUS TUF GAMING X570 (WI-FI) ATX Gaming
★ Storage ★ SSD SB-ROCKET-1TB + SEAGATE 2TB Barracuda IHD
★ Cooling ★ NOCTUA NH-D15 CHROMAX BLACK 140mm + 10 of Noctua NF-F12 PWM
★ PSU ★ ANTEC HCG-1000-EXTREME 1000 Watt 80 Plus Gold Fully Modular PSU
★ Case ★ LIAN LI PC-O11 DYNAMIC XL ROG (BLACK) (G99.O11DXL-X)
★ Monitor ★ LG Ultragear 27" 240Hz Gaming Monitor
★ Keyboard ★ TVS Electronics Gold Keyboard
★ Mouse ★ Logitech G502 Hero
-
Jan 4th, 2010, 02:53 AM
#8
Re: run time error 380
Make sure your listview has at least 4 columns at design time, otherwise you will hit error 380 when you use ....SubItems(x) where x = 1, 2 or 3.
-
Jan 4th, 2010, 03:16 AM
#9
Thread Starter
Addicted Member
Re: run time error 380
 Originally Posted by anhn
Make sure your listview has at least 4 columns at design time, otherwise you will hit error 380 when you use ....SubItems(x) where x = 1, 2 or 3.
In design time I use 4 colums header. now show a msg: "invalid use of null" and then select this line
Code:
lvwItem.SubItems(3) = rs!unit
now I what need to do.
-
Jan 4th, 2010, 03:20 AM
#10
Re: run time error 380
What is the value of rs!unit?
A good exercise for the Heart is to bend down and help another up...
Please Mark your Thread " Resolved", if the query is solved
MyGear:
★ CPU ★ Ryzen 5 5800X
★ GPU ★ NVIDIA GeForce RTX 3080 TI Founder Edition
★ RAM ★ G. Skill Trident Z RGB 32GB 3600MHz
★ MB ★ ASUS TUF GAMING X570 (WI-FI) ATX Gaming
★ Storage ★ SSD SB-ROCKET-1TB + SEAGATE 2TB Barracuda IHD
★ Cooling ★ NOCTUA NH-D15 CHROMAX BLACK 140mm + 10 of Noctua NF-F12 PWM
★ PSU ★ ANTEC HCG-1000-EXTREME 1000 Watt 80 Plus Gold Fully Modular PSU
★ Case ★ LIAN LI PC-O11 DYNAMIC XL ROG (BLACK) (G99.O11DXL-X)
★ Monitor ★ LG Ultragear 27" 240Hz Gaming Monitor
★ Keyboard ★ TVS Electronics Gold Keyboard
★ Mouse ★ Logitech G502 Hero
-
Jan 4th, 2010, 03:42 AM
#11
Re: run time error 380
 Originally Posted by abu taher
In design time I use 4 colums header. now show a msg: "invalid use of null" and then select this line
Code:
lvwItem.SubItems(3) = rs!unit
now I what need to do.
A subitem cannot have Null value. If rs!unit is Null then you have convert it to "" (empty string), perhaps like this:
Code:
lvwItem.SubItems(3) = "" & rs!unit
Tags for this Thread
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|