Wrox Programmer Forums
Go Back   Wrox Programmer Forums > .NET > Other .NET > .NET Web Services
| Search | Today's Posts | Mark Forums Read
.NET Web Services Discussions about .NET XML Web Service technologies including ASMX files, WSDL and SOAP.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the .NET Web Services 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
  #1 (permalink)  
Old October 21st, 2003, 06:38 PM
Authorized User
 
Join Date: Oct 2003
Location: , , Norway.
Posts: 45
Thanks: 0
Thanked 0 Times in 0 Posts
Default I'm back :) Listbox var from listbox

Hi people, (Yes you to Peter :-)
I have a listbox (named lbxMyGroup). I want to insert both values from this (value and text) into a SQL Table. But I get a NULL.refrence error when I try the code below. I guess it's not getting the values from lbxMyGroup.SelectedItem.Text and lbxMyGroup.SelectedValue correctly. Anybody got a clue for me?

*********************CODE***************
'Add Groups to GroupMembers Table.
Dim li As ListItem
 For Each li In lbxMyGroup.Items
  Response.Write("selItem.Text" & lbxMyGroup.SelectedItem.Text & "<br>")
  Response.Write("selValue" & lbxMyGroup.SelectedValue & "<br>")
  SQL.Execute("Insert into GroupMembers.....
 Next


As alway.. a big thanks for any help.

All help is Good help!
Regards
Michael
__________________
------------------------
All help is Good help!
Regards
Michael
  #2 (permalink)  
Old October 21st, 2003, 06:58 PM
Authorized User
 
Join Date: Oct 2003
Location: , , Norway.
Posts: 45
Thanks: 0
Thanked 0 Times in 0 Posts
Default

OK ok ok.. My last post was a bit stupid, I cant get a selected value from an array now can I.... So I'm now working on something like this:

*********** NEW BETTER CODE (he he)*********
Dim i As Integer
For i = 0 To lbxMyGroup.Items.Count - 1
 Response.Write("selItem.Text" & lbxMyGroup.???? & "<br>")
Next

But I still cant figure out how to get my values. (problem is where all the ? are). What do I write there to get the values?

Still working on it.. Will post again if I can clue out how it's done before some mercifull soul drops a line.

------------------------
All help is Good help!
Regards
Michael
  #3 (permalink)  
Old October 21st, 2003, 07:06 PM
Authorized User
 
Join Date: Oct 2003
Location: , , Norway.
Posts: 45
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Thanks for the help Michael.. *Smile*
Sorry to use up the space here, I found the answer (getting toooo dependent of the auto help in Visual Studio, forget to think sometimes... Dim Michael as string = "stupid")

Well, for all you readers that have followed my amazing progress. Here is the secret to all my troubles.

***********Working Code***********
Dim i As Integer
For i = 0 To lbxMyGroup.Items.Count - 1
 Response.Write("selItem.Text: " & lbxMyGroup.Items(i).Text & "<br>")
 Response.Write("selItem.Text: " & lbxMyGroup.Items(i).Value & "<br>")
Next

------------------------
All help is Good help!
Regards
Michael


Similar Threads
Thread Thread Starter Forum Replies Last Post
ListBox belete ASP.NET 2.0 Basics 2 October 19th, 2007 04:46 AM
multiple Listbox values in another listbox terryv Excel VBA 0 June 27th, 2007 07:01 AM
Help with listbox MMJiggy62 Beginning VB 6 5 July 11th, 2006 10:56 PM
Listbox alastair Access 7 January 25th, 2006 05:53 PM
Listbox vanjamier Pro JSP 0 January 6th, 2005 09:44 PM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.