.NET Tutorials, Forums, Interview Questions And Answers
Welcome :Guest
Sign In
Register
 
Win Surprise Gifts!!!
Congratulations!!!


Top 5 Contributors of the Month
Easy Web
Imran Ghani
Post New Web Links

Arrays in asp.net vb.net

Posted By:      Posted Date: August 27, 2010    Points: 0   Category :ASP.Net
 

Hello

i have a little question about array in ASP.NET or vb.net.

In my classic ASP-Application i use arrays like this

<%
dim ubbarray, txt
ubbarray = _
Array( _
Array("string1","string11","string111"), _
Array("string2","string22","string222"), _
Array("string3","string33","string333") _
)

for i = 0 to ubound(ubbarray)
txt = txt & "a:" & ubbarray(i)(0) & " b:" & ubbarray(i)(1) & " c:" & ubbarray(i)(2) & "<br/>"
next

response.write txt
%>

The reason is, i would like to bild a little editor with some buttons and javascipt. But a script like this doesn't work in ASP.NET vb.net.

Thank you in advance for helping me.




View Complete Post


More Related Resource Links

Need help with objects and arrays

  

I have an objuct that I declared like this:

    Class DailyStats
        Dim _day As String
        Dim _hour As String
        Dim _impressions As String
        Dim _clicks As String
        Property Day() As String
            Get
                Return _day
            End Get
            Set(ByVal value As String)
                _day = value
            End Set
        End Property
        Property Hour() As String
            Get
                Return _hour
         

Need more help with objects and arrays

  

Here's my class:

Class WeeklyStats
        Dim _weekstart As String
        Dim _day As String
        Dim _impressions As String
        Dim _clicks As String
        Property Weekstart() As String
            Get
                Return _weekstart
            End Get
            Set(ByVal value As String)
                _weekstart = value
            End Set
        End Property
        Property Day() As String
            Get
                Return _day
            End Get
   &nb

Expose DataTable from WCF service, all Generic lists convert to arrays

  
I added a method to a .Net 3.5 WCF web service that returns a DataTable.  Other methods in the web service return Generic lists and/or take Generic lists as parameters.  When I update my reference to the altered web service from my client application all generic lists used as parameters or return types from all methods in the web service are converted to arrays.  In my service reference settings I have selected "System.Collections.Generic.List."  Apparently this setting has no effect when a web service returns a DataTable? Is there any way to prevent this from occuring? Steps to reproduce: Create a web service with methods that return Generic lists and/or take Generic lists as parameters. In a client application reference the web service and select "System.Collections.Generic.List" as the collection type.  Verify that return types/parameter types are generic lists. Add a method to the web service that returns a DataTable.  In a client application update the service reference. Note that all Generic lists (either as return types or method parameters) have changed to arrays.  This occurs even though the collection type service reference setting remains as "System.Collections.Generic.List".  Tom Regan

How to create an extremely large array/object (> 2 GB) without using jagged arrays ?

  
Hello,I had implemented a matrix scaling algorithm in Java (64-bit) for a university project and have now implemented the code in C# with .NET 3.5 64-bit. One of the operations I did in Java was creating a rectangular array with double[][] = ... (in C# this is a jagged array!) to store a symmetric matrix which is used as input for the algorithm. Since I was using matrices with n up to 30720, memory usage for the single matrix object was around 8 GB in it's maximum and with matrix multiplication around 20 GB.So... now I implemented this in C# and I am shocked to see that double[,] (rectangular arrays) can only be 2 GB in size even on 64-bit! That means that for matrices with n larger than ~15000 I will get OutOfMemory Exceptions although there is a huge amount of free memory (I have two quad core systems with 12 GB and 24 GB Ram). When I use jagged arrays in C# (i.e. double[][]) I can create larger matrices. That is because I have one small array with the size of the row number (i.e. n) and then for each row an array of size n, but they are all single objects so I don't reach the 2 GB per object limit. The problem with jagged arrays is that they are horribly slow for matrice calculations compared to rectangular arrays and even slower compared to single dimension arrays.Actually I intended to rewrite my code and simulate the matrices in single arrays (see sample code below) bec

Collection is read-only Arrays in models

  
I'm about to pull my hair out with this one. I have a model with 2 arrays of inputs that looks like this public partial class MyModel : MyModel { public double?[] Array1{ get; set; } public double?[] Array2; public MyModel() { Array1 = new double?[10]; Array2 = new double?[10]; } }Now, if I change Array1 to look like Array2 (Remove the accessors) I don't get an error, However after posting the data all the elements in the arrays are null. Now if I do either of the arrays like Array1 above, Exception Details: System.NotSupportedException: Collection is read-only.What am I doing wrong here?    public partial class TimesheetWeekModel : TimesheetBaseModel     {         public double?[] Hours { get; set; }         public double?[] Miles;         public TimesheetWeekModel()         {             Hours = new double?[7];             Miles = new double?[7];         }     

Multidimensional Arrays (or) ArrayLists and Object Data Type in SSIS

  
I want to create a multidimensional array dynamically in a Script Component and assign to a Object DataType and then use that variable in another Script Component, to retrieve the elements of the multidimensional array

returning arrays of custom serialized classes

  

Hi!

I have the following class:

[XmlSchemaProvider("MySchema")]
  [XmlRoot("person", Namespace = "http://mme.se")]
  public class Person : IXmlSerializable
  {
    public string FirstName;


    public static XmlQualifiedName MySchema(XmlSchemaSet xs)
    {
      string xsd =
        @"<?xml version='1.0' encoding='utf-8'?>
<xs:schema id='person' 
 targetNamespace='http://mme.se'
 elementFormDefault='qualified'
 xmlns='http://mme.se' 
 xmlns:mstns='http://mme.se' 
 xmlns:xs='http://www.w3.org/2001/XMLSchema'>
 <xs:complexType name='personType'>
  <xs:sequence>
   <xs:element name='f' type='xs:string'/>
  </xs:sequence>
 </xs:complexType>
</xs:schema>";

      var schemaSerializer = new XmlSerializer(

Multiple users & arrays?

  

On my website, the user can enter in information in multiple textboxes and click an "Add" button, which then adds the information to an array as 1 project. When they click a "Finish" button, it takes them to a Review page and reviews all of the seperate projects they have submitted.

When we tested this website out, at one point I got to the review page and saw information that I never submitted. I'm assuming it was submitted by the other person who was testing the page at the same time I was testing the page. 

My question is, if multiple users are on my page at the same time submitting information, is it possible for the information to be added to someone else's array ? Can somebody's information overlap another person's information?

Here's my array:

Option Strict On
Imports System.IO
Imports Microsoft.VisualBasic

Public Class clsBarn
    Structure Barn
        Dim BarnNo As String
        Dim FlockNo As String
        Dim Birds As Integer
        Dim WkMortF As Integer
        Dim WkMortM As Integer
        Dim BirdsAdded As Integer
        Dim AvgHighTemp As Integer
        Dim AvgLowTemp As Integer
        Dim BodyWeight As Decimal
        Dim BirdsUniAmt As Decimal
        Dim GalWtr As Integer
        Dim LightHours As D

Combine two byte arrays

  

I have two byte arrays from rdlc reports.

I need to create a pdf combining both the byte arrays.

My code is

Warning[] warnings;
                string[] streamIds;
                string mimeType = string.Empty;
                string encoding = string.Empty;
                string extension = string.Empty;

                bytes = rptViewer.LocalReport.Render("PDF", null, out mimeType, out encoding, out extension, out streamIds, out warnings);

                bytes1 = RunReport(21316228, "82", 7);

                byte[] combined = new byte[bytes.Length + bytes1.Length];
                bytes.CopyTo(combined, 0); 
             &

Combine two byte arrays from rdlc to create a pdf

  

I have two byte arrays from rdlc reports.

I need to create a pdf combining both the byte arrays.

My code is

Warning[] warnings;
                string[] streamIds;
                string mimeType = string.Empty;
                string encoding = string.Empty;
                string extension = string.Empty;

                bytes = rptViewer.LocalReport.Render("PDF", null, out mimeType, out encoding, out extension, out streamIds, out warnings);

                bytes1 = RunReport(21316228, "82", 7);

                byte[] combined = new byte[bytes.Length + bytes1.Length];
                bytes.CopyTo(combined, 0); 
             &

Using dynamic controls (making arrays of controls)

  

Hi guys I m new to forum

I m stuck up in following code what i want to do is every time user clicks the button it should display 1 more panel (in project button is for showing for experience input fields so if some person have more than one experience than by simply click this button it should show one more set of controls  )

please check code below

using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

public partial class AddExprience : System.Web.UI.Page
{
    Label[] Company_label_arr=new Label[50];
    TextBox[] Company_textbox_arr = new TextBox[50];

    Label[] Position_label_arr = new Label[50];
    TextBox[] Position_textbox_arr = new TextBox[50];

    Label[] Responsiblity_label_arr = new Label[50];
    TextBox[] Responsiblity_textbox_arr = new TextBox[50];

    Label[] ResonForLeaving_label_arr = new Label[50];
    TextBox[] ResonForLeaving_textbox_arr = new TextBox[50];

    Panel[] panel_arr=new Panel[50];
    Int32 count=0;
    Label lsd = new Label();
    Control[] control11=new Control[50]; 
    
    protected void Page_Load(object sender, EventArgs e)
    {
     
      
    }

    protected void AddExpButton_Click(object sender, EventArgs e)
    {        
        count = System.Convert.ToInt32(Session["count1"

Add Service Reference changing list to arrays in proxy class

  

I'm trying to consume an asmx service in a console app. When I add the service reference to my project i'm noticing that in the proxy class the lists are replaced with arrays. Also, the default constructors are missing. This is causing problems when i'm attempting to build the request object using the proxy classes. I've generated some classes using xsdobjectgen which i'm using as parameters to my web method. I've tried changing the Collection type in the settings but its still not working. Any ideas on whats going wrong?

 


Add Service Reference changing list to arrays in proxy class

  

I'm trying to consume an asmx service in a console app. When I add the service reference to my project i'm noticing that in the proxy class the lists are replaced with arrays. Also, the default constructors are missing. This is causing problems when i'm attempting to build the request object using the proxy classes. I've generated some classes using xsdobjectgen which i'm using as parameters to my web method. I've tried changing the Collection type in the settings but its still not working. Any ideas on whats going wrong?

 


dynamic arrays

  

I created a dynamic array

 

 

Dim li_attachment(,) As String = New String(,) {}

How do i pass values to it like

li_attachment(li_lead_count - 1, 0) = leaddocname   - get error expresion not function

 

should i use array or something else?

 


multi dimensional arrays???

  

I have the following code in which I pass 1 value in the array after comparing 2 data tables.

Now how do I pass all the values from the data tables rows (like docfiletype, docseqid) in one array(or should I use something else)? so that I can sort the array based on docseqid?

 

Dim ls_attachment_filename() As String = Nothing
 Dim li_attachment_count As Integer
Dim j As Integer
                    
For j = 0 To leadrowcount - 1

                        Dim docidatt As String = recordDatatable.Rows(j).Item(0).ToString
                        Dim docredid As String = recordDatatable.Rows(j).Item(1).ToString
                        Dim docfiletype As String = recordDatatable.Rows(j).Item(2).ToString
                        Dim docsize As String = recordDatatable.Rows(j).Item(3).ToString
                        Dim docseqid As String = recordDatatable.Rows(j).Item(4).ToString
                        Dim k As Integer
                        For k = 0 To rowcasecount - 1
                            Dim caseidatt As String = caseDatatable.Rows(k).Item(0).ToString
                            Dim caseredid As String = caseDatatable.Rows(k).Item(1).ToString
                            Dim casefiletype As String = caseDatatable.Rows(k).Item(2).ToString
                            Dim casesize As String = caseDatatable

Arrays problum

  

when i am creating arraya of any size (depends user suppose lenth is 10) and geting data at run time by user through loop if user has only 7 records and user dont want continioue than exception is genrating in console programing  remember the array is int type.what is the problum 

can we not have empty some index of array???


Categories: 
ASP.NetWindows Application  .NET Framework  C#  VB.Net  ADO.Net  
Sql Server  SharePoint  Silverlight  Others  All   

Hall of Fame    Twitter   Terms of Service    Privacy Policy    Contact Us    Archives   Tell A Friend