 |
| Pro VB.NET 2002/2003 For advanced Visual Basic coders working .NET version 2002/2003. Beginning-level questions will be redirected to other forums, including Beginning VB.NET. |
Welcome to the p2p.wrox.com Forums.
You are currently viewing the Pro VB.NET 2002/2003 section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
|
|
|
|

July 8th, 2004, 02:46 AM
|
|
Authorized User
|
|
Join Date: Jun 2003
Posts: 63
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
Hi
at the start of the code type
try
<insert rest of code here>
catch e as exception
messagebox.show(e.message)
end try
Duncan
|
|

July 9th, 2004, 09:01 AM
|
|
Authorized User
|
|
Join Date: Jul 2004
Posts: 15
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
I ran the catch program and this is the error that I got. Line1: incorrect syntax near 'false'. Well this line here---
Dim strSQl As String = strSQl = "INSERT INTO [Auto] (ItemImage) VALUES (@MyImage)"
strSQL is = to 'false' when I run my break points. When the user types in a value in a text box and clicks the add button, a new form appears with the drawing program. I have a menu at the top with the save menu in it. My question is when the user types in a value on the previous form and clicks the add button, it saves it to my database. On my drawing form how does it know to save it to that same row in the database. Is that part of my problem?
|
|

July 9th, 2004, 09:05 AM
|
|
Authorized User
|
|
Join Date: Jun 2003
Posts: 63
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
Hi
you code is wrong it should
dim strSql as string = "Insert into [Auto] (ItemImage) VALUES (@MyImage)
run this to see if it helps
Duncan
|
|

July 9th, 2004, 09:14 AM
|
|
Authorized User
|
|
Join Date: Jul 2004
Posts: 15
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
I change that and got a different error. Operand type clash = image is incompatible with int.?
|
|

July 9th, 2004, 09:30 AM
|
|
Authorized User
|
|
Join Date: Jul 2004
Posts: 15
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
I changed the value in my sql database to numeric just to see what would happen. I got the same error Operand type clash = image is incompatible with numeric but with numeric. What should the data type be?
|
|

July 9th, 2004, 11:22 AM
|
|
Authorized User
|
|
Join Date: Jun 2003
Posts: 63
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
Hi
Why are you trying to store an image into a numeric datatype, you have specified the data type in the parameter query as an system.data.sqldbtype.image, so I thought it would be obvious that the datatype in the database would need to be the same.
Duncan
|
|

July 9th, 2004, 12:30 PM
|
|
Authorized User
|
|
Join Date: Jul 2004
Posts: 15
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
You are 100% correct. Thanks for the input. The last problem that im having now is taking the value from a text box on the previous form and putting that in my update query on the current form. this is what I tried
Public AddItemNum As String
AddItemNum = Val(txtAddItemNumber)
But it says ((Argument 'Expression' cannot be converted to type 'TextBox'.))
|
|

July 9th, 2004, 12:45 PM
|
|
Authorized User
|
|
Join Date: Jun 2003
Posts: 63
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
Hi
If the previous form is shown using "showdialog" then you can get the values from that ie...
dim AdditemNumber as int32 'declare variable
dim frm as new form1 'this will create an instance of the form
frm.showdialog() 'this will show the form and let the user enter data
additemnumber = frm.txtadditemnumber.text
frm.close 'remeber to close the form as this will remain hidden
Duncan
|
|

July 9th, 2004, 02:21 PM
|
|
Authorized User
|
|
Join Date: Jul 2004
Posts: 15
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
Can I just declare a variable on one form and use its value on another. That seems like it would be easer. I know how to do it in regular vb.
|
|

July 10th, 2004, 04:08 AM
|
|
Authorized User
|
|
Join Date: Jun 2003
Posts: 63
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
Hi
Well not really because the variable declaration would not be inscope between the two forms, and declaring a global varible is a BIG No No. you might be best to create a public property that gets the value from the first form and the second form can read from that public property
first form
private _isAddItem as string 'or what ever data type you need
public property IsAddItem as string 'or what ever datatype you need
get
return _isadditem
end get
set (value as string)
_isadditem = value
end set
end property
in the text changed event
private sub Text1_changed(sender, e)
_isadditem = me.text1.text
end sub
in form two
you just need to call IsAddItem and you should get the value
Duncan
|
Similar Threads
|
| Thread |
Thread Starter |
Forum |
Replies |
Last Post |
| urgent |
deb_kareng |
ASP.NET 2.0 Professional |
1 |
August 13th, 2007 07:29 AM |
| it's urgent |
deb_kareng |
ASP.NET 2.0 Professional |
3 |
August 7th, 2007 07:40 AM |
| urgent help |
yash_coolbuddy_forindia |
BOOK: Wrox's ASP.NET 2.0 Visual Web Developer 2005 Express Edition Starter ISBN: 978-0-7645-8807-5 |
1 |
May 7th, 2007 08:40 AM |
| urgent???????????? |
nsr35 |
Beginning VB 6 |
1 |
October 3rd, 2005 10:57 AM |
| urgent ??????????????? |
nsr35 |
Pro VB Databases |
0 |
October 3rd, 2005 04:53 AM |
|
 |