473,804 Members | 3,018 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

How do you autoincrement a variable name

I am interested in dumping some results from a collection I have into a group
of variables. I have a counter that loops but I don't know how to use the
counter to determine my variable names.

Here is my code...

Imports System.Web
Imports System.Web.Serv ices
Imports System.Web.Serv ices.Protocols

Namespace CiscoSwitch
Public Class SwitchInterface s
Public SwitchPort1 As String
Public SwitchPort2 As String
Public SwitchPort3 As String
Public SwitchPort4 As String
Public SwitchPort5 As String
Public SwitchPort6 As String
Public SwitchPort7 As String
Public SwitchPort8 As String
Public SwitchPort9 As String
Public SwitchPort10 As String
Public SwitchPort11 As String
Public SwitchPort12 As String
Public SwitchPort13 As String
Public SwitchPort14 As String
Public SwitchPort15 As String
Public SwitchPort16 As String
Public SwitchPort17 As String
Public SwitchPort18 As String
Public SwitchPort19 As String
Public SwitchPort20 As String
Public SwitchPort21 As String
Public SwitchPort22 As String
Public SwitchPort23 As String
Public SwitchPort24 As String
End Class
End Namespace

<WebService(Des cription:="Stat us of Switch Interfaces ONLY ",
Namespace:="htt p://10.33.32.158/CoinsEngineV1") > _
<WebServiceBind ing(ConformsTo: =WsiProfiles.Ba sicProfile1_1)> _
<Global.Microso ft.VisualBasic. CompilerService s.DesignerGener ated()> _
Public Class Service
Inherits System.Web.Serv ices.WebService

<WebMethod()> _
Public Function Get3750Interfac eInfo() As CiscoSwitch.Swi tchInterfaces
Dim InterfaceStatus As New CiscoSwitch.Swi tchInterfaces
Dim ArrayCounter As Integer = 0

Dim InterfaceInfo1( 30) As String
InterfaceInfo1 = New String(30) {}
Dim InterfaceInfo2( 30) As String
InterfaceInfo2 = New String(30) {}

Dim SNMPOutput As String = ""
Dim SNMPTargetDevic e As String = "192.168.0. 100"
Dim SNMPCommunitySt ring As String = "public"
Dim WMILocator As Object = CreateObject("W BemScripting.SW BemLocator")
Dim WMIServices As Object = WMILocator.Conn ectServer("",
"root\snmp\loca lhost")
Dim WMINamedValueSe t As Object =
CreateObject("W BemScripting.SW BemNamedValueSe t")
WMINamedValueSe t.Add("AgentAdd ress", SNMPTargetDevic e)
WMINamedValueSe t.Add("AgentRea dCommunityName" , SNMPCommunitySt ring)
'Dim colSystem = WMIServices.Ins tancesOf("SNMP_ RFC1213_MIB_sys tem",
, WMINamedValueSe t)
Dim colSystem = WMIServices.Ins tancesOf("SNMP_ RFC1213_MIB_ifT able",
, WMINamedValueSe t)
Try
For Each objSystem As Object In colSystem
InterfaceStatus .SwitchPort.CSt r(ArrayCounter) =
objSystem.IfOpe rStatus
ArrayCounter = ArrayCounter + 1
Next
Catch ex As Exception
SNMPOutput = "There is some kind of problem..."
End Try
Return InterfaceStatus

End Function

May 8 '06 #1
2 2534
Why not make Switchport an array instead (Public SwitchPort(24) as String)?
"Military Smurf" <Mi***********@ discussions.mic rosoft.com> wrote in message
news:26******** *************** ***********@mic rosoft.com...
I am interested in dumping some results from a collection I have into a
group
of variables. I have a counter that loops but I don't know how to use the
counter to determine my variable names.

Here is my code...

Imports System.Web
Imports System.Web.Serv ices
Imports System.Web.Serv ices.Protocols

Namespace CiscoSwitch
Public Class SwitchInterface s
Public SwitchPort1 As String
Public SwitchPort2 As String
Public SwitchPort3 As String
Public SwitchPort4 As String
Public SwitchPort5 As String
Public SwitchPort6 As String
Public SwitchPort7 As String
Public SwitchPort8 As String
Public SwitchPort9 As String
Public SwitchPort10 As String
Public SwitchPort11 As String
Public SwitchPort12 As String
Public SwitchPort13 As String
Public SwitchPort14 As String
Public SwitchPort15 As String
Public SwitchPort16 As String
Public SwitchPort17 As String
Public SwitchPort18 As String
Public SwitchPort19 As String
Public SwitchPort20 As String
Public SwitchPort21 As String
Public SwitchPort22 As String
Public SwitchPort23 As String
Public SwitchPort24 As String
End Class
End Namespace

<WebService(Des cription:="Stat us of Switch Interfaces ONLY ",
Namespace:="htt p://10.33.32.158/CoinsEngineV1") > _
<WebServiceBind ing(ConformsTo: =WsiProfiles.Ba sicProfile1_1)> _
<Global.Microso ft.VisualBasic. CompilerService s.DesignerGener ated()> _
Public Class Service
Inherits System.Web.Serv ices.WebService

<WebMethod()> _
Public Function Get3750Interfac eInfo() As CiscoSwitch.Swi tchInterfaces
Dim InterfaceStatus As New CiscoSwitch.Swi tchInterfaces
Dim ArrayCounter As Integer = 0

Dim InterfaceInfo1( 30) As String
InterfaceInfo1 = New String(30) {}
Dim InterfaceInfo2( 30) As String
InterfaceInfo2 = New String(30) {}

Dim SNMPOutput As String = ""
Dim SNMPTargetDevic e As String = "192.168.0. 100"
Dim SNMPCommunitySt ring As String = "public"
Dim WMILocator As Object =
CreateObject("W BemScripting.SW BemLocator")
Dim WMIServices As Object = WMILocator.Conn ectServer("",
"root\snmp\loca lhost")
Dim WMINamedValueSe t As Object =
CreateObject("W BemScripting.SW BemNamedValueSe t")
WMINamedValueSe t.Add("AgentAdd ress", SNMPTargetDevic e)
WMINamedValueSe t.Add("AgentRea dCommunityName" , SNMPCommunitySt ring)
'Dim colSystem = WMIServices.Ins tancesOf("SNMP_ RFC1213_MIB_sys tem",
, WMINamedValueSe t)
Dim colSystem = WMIServices.Ins tancesOf("SNMP_ RFC1213_MIB_ifT able",
, WMINamedValueSe t)
Try
For Each objSystem As Object In colSystem
InterfaceStatus .SwitchPort.CSt r(ArrayCounter) =
objSystem.IfOpe rStatus
ArrayCounter = ArrayCounter + 1
Next
Catch ex As Exception
SNMPOutput = "There is some kind of problem..."
End Try
Return InterfaceStatus

End Function

May 8 '06 #2
I tried that first-but, this is going into an Adobe Flash front end over a
web service. Based on my Flash code, each element in the XML file must have
a unique tag, such as:

InterfaceStatus .SwitchPort1 = "up"
InterfaceStatus .SwitchPort2 = "down"

Then the Flash front end can handle the variable values-as an array, it
simply says "object."

"Jason" wrote:
Why not make Switchport an array instead (Public SwitchPort(24) as String)?
"Military Smurf" <Mi***********@ discussions.mic rosoft.com> wrote in message
news:26******** *************** ***********@mic rosoft.com...
I am interested in dumping some results from a collection I have into a
group
of variables. I have a counter that loops but I don't know how to use the
counter to determine my variable names.

Here is my code...

Imports System.Web
Imports System.Web.Serv ices
Imports System.Web.Serv ices.Protocols

Namespace CiscoSwitch
Public Class SwitchInterface s
Public SwitchPort1 As String
Public SwitchPort2 As String
Public SwitchPort3 As String
Public SwitchPort4 As String
Public SwitchPort5 As String
Public SwitchPort6 As String
Public SwitchPort7 As String
Public SwitchPort8 As String
Public SwitchPort9 As String
Public SwitchPort10 As String
Public SwitchPort11 As String
Public SwitchPort12 As String
Public SwitchPort13 As String
Public SwitchPort14 As String
Public SwitchPort15 As String
Public SwitchPort16 As String
Public SwitchPort17 As String
Public SwitchPort18 As String
Public SwitchPort19 As String
Public SwitchPort20 As String
Public SwitchPort21 As String
Public SwitchPort22 As String
Public SwitchPort23 As String
Public SwitchPort24 As String
End Class
End Namespace

<WebService(Des cription:="Stat us of Switch Interfaces ONLY ",
Namespace:="htt p://10.33.32.158/CoinsEngineV1") > _
<WebServiceBind ing(ConformsTo: =WsiProfiles.Ba sicProfile1_1)> _
<Global.Microso ft.VisualBasic. CompilerService s.DesignerGener ated()> _
Public Class Service
Inherits System.Web.Serv ices.WebService

<WebMethod()> _
Public Function Get3750Interfac eInfo() As CiscoSwitch.Swi tchInterfaces
Dim InterfaceStatus As New CiscoSwitch.Swi tchInterfaces
Dim ArrayCounter As Integer = 0

Dim InterfaceInfo1( 30) As String
InterfaceInfo1 = New String(30) {}
Dim InterfaceInfo2( 30) As String
InterfaceInfo2 = New String(30) {}

Dim SNMPOutput As String = ""
Dim SNMPTargetDevic e As String = "192.168.0. 100"
Dim SNMPCommunitySt ring As String = "public"
Dim WMILocator As Object =
CreateObject("W BemScripting.SW BemLocator")
Dim WMIServices As Object = WMILocator.Conn ectServer("",
"root\snmp\loca lhost")
Dim WMINamedValueSe t As Object =
CreateObject("W BemScripting.SW BemNamedValueSe t")
WMINamedValueSe t.Add("AgentAdd ress", SNMPTargetDevic e)
WMINamedValueSe t.Add("AgentRea dCommunityName" , SNMPCommunitySt ring)
'Dim colSystem = WMIServices.Ins tancesOf("SNMP_ RFC1213_MIB_sys tem",
, WMINamedValueSe t)
Dim colSystem = WMIServices.Ins tancesOf("SNMP_ RFC1213_MIB_ifT able",
, WMINamedValueSe t)
Try
For Each objSystem As Object In colSystem
InterfaceStatus .SwitchPort.CSt r(ArrayCounter) =
objSystem.IfOpe rStatus
ArrayCounter = ArrayCounter + 1
Next
Catch ex As Exception
SNMPOutput = "There is some kind of problem..."
End Try
Return InterfaceStatus

End Function


May 8 '06 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
868
by: johnb41 | last post by:
I've searched Google for how to make an element "Auto Increment": <xs:element name="id" minOccurs="0" msdata:AutoIncrement="true" type="xs:integer" /> It's not working! Here is simplified code in my Windows form: (in summary, it's supposed to create a dataset from an XML file. When it's a dataset, I add a new row. I then save it back to an XML file) Dim myStreamReader As New System.IO.StreamReader("XMLFile1.xml")
1
1628
by: A | last post by:
Hi the .column..... autoincrement line gives a fault :: Item cannot be found in the collection corresponding to the requested name or ordinal error number 3265. Must I move the line ? Thanks Alfred Set tbl12 = Nothing Set tbl12 = New Table
0
1409
by: Neil | last post by:
Hi, I'm getting some strange results using the autoincrement column on my datatable. I'm populating a datatable with data from my database and displaying this in a datagrid. The first time I get the data from the database I create a new table with an autoincrement column bind the datagrid to this new table. The auto increment column is displayed as an ID col in the datagrid. The user can add records or modify records at this point, when...
6
16135
by: Dennis | last post by:
I have set a DataTable and one of the columns I set "AutoIncrement" to True. I then populate the Table by setting the columns to values then add the row to the table. I inadverently set the AutoIncrement Columns to different values but didn't get any errors. Should I be able to set the value of an AutoIncrement Column? I would have thought it couldn't be done as the column value was set when a row was added. -- Dennis in Houston
6
9182
by: Michael | last post by:
I am trying to create an access database within Net 2003 using the ADOX library which works fine except when I try to add the AutoIncrement property to the ContactId column. I am experiencing a Property 'item' is ReadOnly error within the below line .Columns("ContactId").Properties("AutoIncrement") = True Am I missing a reference or what am I doing wrong?????
3
3044
by: MP | last post by:
context: vb6/ ado / .mdb format / jet 4.0 (not using Access - ADO only) - creating tables via ADO (don't have access) - all tables have a primary key (PK) - many of the PK will become FK(Foreign Key) in other table(s) - record entries will be made via ADO I am soliciting opinions on the pros and cons of using AUTOINCREMENT versus code generated GUID or LONG value (as far as my limited understanding goes, if I enter a record, and need...
1
3436
by: Mike | last post by:
I have a form that has an embedded subform (Datasheet View) that are linked based on a 1-many ID field. I have a field (SET) in my embedded subform that I want to Autoincrement starting with 1...and adding 1 to every new record. The Autoincrement needs to be separate for each ID. For example when I go to the form and enter a new record in the main form, the SET field should start over at 1 as a default and continue (+1) for each new...
1
7928
by: Grzes_P | last post by:
J have database DB2 and create table T_TEST with fields: ID - integer autoincrement NAME - varchar(50) QTY - Integer I create java bean CMP and install it on Jboss server and when create new record from client I get error: com.ibm.db2.jcc.c.SqlException: DB2 SQL error: SQLCODE: -798, SQLSTATE: 428C9, SQLERRMC: ID
4
2454
by: Tim | last post by:
Hello All, I could use some help on an error that is just now popping it's head up. Seems that the autoincrement numeric has hit 32,767. The autoincrement is used in various locations in the database, but in this case (log sheets), we have hit 32k log entries over the past 2 years. Is there a simple switch to set the autoincrement from integer to long integer?
3
3798
by: Csaba Gabor | last post by:
Is there any way to detect, based strictly on querying the structure of a table/database whether there is an AUTOINCREMENT set? That is to say, without analyzing the original SQL creation statement, and without inserting a new element into the database. Consider: CREATE Table myTab (col1 INTEGER AUTOINCREMENT PRIMARY KEY) vs. CREATE Table myTab (col1 INTEGER PRIMARY KEY)
0
9591
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10594
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10343
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
10087
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
9166
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7631
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 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 a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
1
4306
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
3831
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
3001
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.