473,322 Members | 1,401 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,322 software developers and data experts.

Maybe simple, but..

8
Please, can anyone tell me, why this does not work:
(I am a beginner)

Expand|Select|Wrap|Line Numbers
  1. Imports system.web.ui.Webcontrols
  2.  
  3. Dim ctrl As webcontrol
  4. Dim str as string
  5.  
  6. For Each ctrl In me.Controls
  7.  
  8. If ctrl.Controls.Count > 0 Then
  9.                 str= str & "Jel"
  10.             Else
  11.                 str = "nothing found"
  12.             End If
  13.         Next
Oct 27 '08 #1
5 1055
kenobewan
4,871 Expert 4TB
Please, can anyone tell me, why this does not work:
(I am a beginner)

Expand|Select|Wrap|Line Numbers
  1. Imports system.web.ui.Webcontrols
  2.  
  3. Dim ctrl As webcontrol
  4. Dim str as string
  5.  
  6. For Each ctrl In me.Controls
  7.  
  8. If ctrl.Controls.Count > 0 Then
  9.                 str= str & "Jel"
  10.             Else
  11.                 str = "nothing found"
  12.             End If
  13.         Next
What makes you suspect that it is not working? What are you hoping that it will do?
Oct 27 '08 #2
OuTCasT
374 256MB
txtAnswer.text = str

You will get an answer then.
Oct 27 '08 #3
Jelle
8
Excuse me, I wasn't complete in my question.
I want to make a SQL-string of the names and the values of all the control.id's and the control.text's like this.

Expand|Select|Wrap|Line Numbers
  1. For each ctrl in Me.Controls
  2.    strId = strId & ctrl.id & ", "
  3.    strValue = strValue & ctrl.text & ", "
  4. Next
  5.  
  6. strSQL = "INSERT INTO " & strId " VALUES " & strValue & ";"
Then I get the error:
"Exception Details: System.InvalidCastException: Unable to cast object of type 'System.Web.UI.LiteralControl' to type 'System.Web.UI.WebControls.WebControl'."
Jelle
Oct 27 '08 #4
Curtis Rutland
3,256 Expert 2GB
Try adding this line above your loop:
Expand|Select|Wrap|Line Numbers
  1. Dim ctrl as WebControl
  2.  
Also, please use [CODE] [/CODE] tags when you are posting code.
Oct 27 '08 #5
Jelle
8
Thanks, but I did so. See my first mail.
Jelle
Oct 27 '08 #6

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

Similar topics

3
by: edoepke | last post by:
I have an application that copies files from one folder on a client machine over the network to another folder on the server and it works very well. The To and From locations are hard coded into...
12
by: stefanogaburri | last post by:
This is crossposted to comp.lang.python & comp.multimedia; if there is a better place to go please tell me :) I've been asked to build a quick-and-dirty prototype of a simple computer-based...
9
by: Brian Kelley | last post by:
I have been using gettext and various utilities to provide internationalization for a wxPython application and have not really been liking the process. Essentially it uses a macro-style notation...
5
by: | last post by:
gcc provides the libc which have more functions than standard C libraries. I saw in Windows API similar functions too, with identical parameters! So, I ask again: Why not, a committee specifies...
13
by: Andy K | last post by:
Hi , I'm wondering what's going on with a restore I'm trying to do . My DB2 version is a 7.2 on a Linux RH ES 2.1 . I've copy a recent backup that was on NAS for a test on my machine . I...
0
by: Andy K | last post by:
Hi everyone , I just ran the following command line : ./asncmd (to check out) and it displayed the following line : 2005-06-16-08:34:08 ASN0000S: INTERNAL ERROR OCCURRED FOR MESSAGE NUMBER...
9
by: Colin McGuire | last post by:
Hi, I have an report in Microsoft Access and it displays everything in the table. One column called "DECISION" in the table has either 1,2, or 3 in it. On my report it displays 1, 2, or 3. I want...
3
by: Michael | last post by:
Hello, I am trying to add some kind of counter in a datatable, i use SetValue but it don't semm to work. Here is the code System.Data.DataSet dsClubs = new System.Data.DataSet(); ...
4
by: ruca | last post by:
Hi, I have an web application with fields that must be the filters for some results. To show the result I have a datagrid. So far so good. To distinguish filter fileds from datagrid I put a...
1
by: frizzle | last post by:
Hi there, I'm building a forum with a mysql backend. The forum has the following structure: - category |--> forum |--> thread |--> replies Once the user has defined a forum (id), i first...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

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.