Deleting Element From Structure
Apr 25, 2010I'm running into deep trouble with this structure variable! this is the structure
[Code]...
I'm running into deep trouble with this structure variable! this is the structure
[Code]...
I want to be able to reference an element in an array of structures by the name of the element in a visual basic 2010 function. For example
Public Structure myStruct
Public element1 as string
Public element2 as integer
Public element3 as boolean
[code]...
Is it possible to reference a structures element by the element's name in a similar way to that shown above. The code shown above does not work, as the expression obj(i).[elementName] does not work as hoped.
explain what I need to do at the bottom here? I can not figure out what is meant by setting the element of the structure to the value.. Option Strict On
[Code]....
I am writing a class and room scheduling program, and would like to use an arraylist that will contain structures. The structure has a couple of arrays in it for when the class meets, and I am having difficulties figuring out the correct syntax to declare the array in the structure. Additionally, in the syntax to access the array. For instance, say I want the MeetingDays to be T, F, T, F, F, F, F; the Meeting Times to be "8:00AM", "", "8:00AM". "", "", "", "", ""; and the Duration to be 75, 0, 75, 0, 0, 0, 0
Public ClassList As ArrayList = New ArrayList
Public Structure MyStructure
Private _ClassName As String
[code].....
I have an array of structures:
[Code]...
An array of the above structure with 30 element. I want to sum the empsal of those emp elements whose emp.empName & emp.empAge is equal.
[Code]...
I would like to bind the text field of a textbox to an element in an instance of a structure that I've created in a class module. When I try to create a Data Source using an OBJECT type, all I see in the tree is the name of the structure, not the instance I've created. If I select the structure anyway, the Data Sources tree does show the name of the structure and the element I'm interested in. How do I bind to a specific instance?
View 1 RepliesI'm writing a rather complex VB2008 programme, To simplify the things, here is the code:
Structure strucFirst
Dim Field1 as Integer
Dim Field2 as Single
[Code]....
I'm not sure if the pseudocode above is possible in VB at all?
I have a number of rewrite rules for a lot of things that I did in IIS7, like removing trailing slashes, canonnical URLs, lowercase lettering, and such. IIS altered my web.config, and everything works fine on the website, like it should. But in the Visual Studio web.config, the opening < rewrite > statement is underlined in blue, and at the bottom of VS, it says that the element 'system.webServer' has invalid child element 'rewrite'. But this is how IIS made it. I didn't do this manually. Should I be concerned with this VS error, or should I just leave as be, since it's working how it should work? Here's an example of my web.config:
[Code]...
Is there a way to control the way a browser behaves such as if I click on this link it doesn't navigate to that link but instead show me the source code behind that button?
View 1 RepliesI need to randomly pick an element from an array and I can only use that element three times,I can randomly pick the element but how do I go about only using it three times.
View 4 RepliesI have been doing well and also I am a noob I know it and you know it a lot has started making sense and I am evening figuring new things out without using Google but of course I have hit another snag in my program so here goes
I am waiting for an email to arrive (the page automatically refreshes) and then I want to click the link (I do not need to click to open the email or anything like that) I also have the code to click and navigate to the address reason being it was the only way I could figure out how to stop it opening in a new window on IE
So my only problem is I need a way to check every x seconds for the element and then if its there proceed with my code and if its not wait and then check again or however this is done in VB.If this is not the way its done please point me in the right direction the code I am using to find and then navigate to the link is
Dim emailpageelements As HtmlElementCollection = WebBrowser2.Document.GetElementsByTagName("a")
For Each emailver As HtmlElement In emailpageelements
If InStr(emailver.InnerHtml, "https://twitter.com/account/confirm_email/") Then
WebBrowser1.Navigate(emailver.InnerText)
[Code]...
Module Module1
Public Structure structure1
Public TRANS() As structure2
End Structure
Public Structure structure2
Public X() As Integer
End Structure
End Module
I'm new to VB 2008 after having spent a long time with VB6, so I apologize if this is a stupid question. But I'd really like to have this straightened out.
Let's say I have a pretty large structure that has lots of properties.
Code:
Now say that I want an internal database with about 10 instances of this structure total, describing, say, 10 different products that a store sells. When these values are loaded from a database, they remain totally static. (However, they can be different each time a program loads)
Now say that I have a class. Each instance of this class is a type of that BaseProduct structure. Meaning, each instance of the class pertains to one of the 10 types of products that the store sells. However, this class has additional properties that pertain specifically to each instance, which are not static.
Code:
Now, the problem here is... If I have 200 different transactions, each one contains an instance of BaseProduct. BaseProduct is HUGE, and is largely redundant (only 10 types possible), so I think it's a little silly to include a whole copy of it with EVERY transaction. However, the Transaction class really needs information regarding the base product it pertains to. Is there a way to, instead of declaring a New BaseProduct in the Transaction class, to simply make one of the properties of the Transaction class a pointer to a BaseProduct variable?
In VB6, I would accomplish this by making a BaseProduct(10) array, and then giving each Transaction an ID number referring to an entry in that array. But in VB 2008, using class structure, this is impossible. I can't define the BaseProduct(10) array outside of a class in a namespace, and if I define it in the actual application's form, then the class loses modularity since it relies on the application that's using it.
I am trying to communicate with an external device and i am trying to send a byte array to the external device via sockets but i am always getting a response the message size is too small so i am not sure what i have done wrong. Between the data type there should be no alignment present and all numbers are represented in little endian format. The char array is not null terminated as mentioned in the protocol specifications.
I have to send data based on a struct that embeds 2 other struct. So here's my vb.net code for the struct used to convert to byte array and the sending part.
Public Structure MESSAGETYPE_OIP_Login
Dim Header() As COMMANDHEADER
Dim UserName() As PSTRING
[Code]....
I'm experiencing a problem with the following c-structure:
typedef struct tagTEXTUREPROP
{
DWORD dwSize;
[Code].....
The Marshal.SizeOf obviously calculates a size of 76 and it works with the DLL function, but it leaves me with some bad feelings.
I'm having a problem that's driving me crazy; I can't understand how to convert the XML structure into a class structure (that I want to use to hydrate a XML document).
The XML document looks like this:
xml
<?xml version="1.0" encoding="utf-8"?>
<artists xmlns:opensearch="http://a9.com/-/spec/opensearch/1.1/" xmlns="http://www.spotify.com/ns/music/1">
[code]....
I want to make a structure within a structure. Basically it will appear like this:
Structure ID
dim CardType as string
im CardCode as string
[code]......
In Vb.net I am trying to assign an array of structure to another array of same structure[code]...
View 2 RepliesI have the following XML:
[Code]...
I am accessing the name of the child element like this:
[Code]...
I would like the following function to return Nothing if the element with the specified key is not in the collection. Instead, it returns an error - something to the effect of "no element found"
Public Class MyCollection
Inherits System.Collections.ObjectModel.Collection(Of MyType)
Public Function FindByActivityKey(ByVal searchValue As Integer) As MyType
[code]....
I would like to associate a web page element, a textbox for example, with a textbox in my form. When a user types something in the textbox, I would like it to be like he types it on the webpage.
View 1 RepliesI know I can create XML ouput in Example 1 as follows using the following code in Example 2. How do I create the same output in Example 3?[code...]
View 9 RepliesI have two structrures
Public Structure PhoneScheduleEntries
Dim Count As UInteger
Dim PhoneSchedule() As PhoneScheduleEntry
End Structure
form method="POST" action="">
<input type="hidden" name="formtoken" value="33664efb6d22f84ff9dff62275fbb8a7" />
<input type="text" name="num" value="+97798""/><br/>
Enter Message To Be Sent:<br/>
<textarea name="msg" rows="8">
I've been trying to use the AutoComplete Extender from the ASP.NET Ajax Control Toolkit, however I've been having tons of trouble getting it to actually work. To install the AjaxControlToolKit, I've placed it inside my application's bin directoy, then I just dragged and dropped the control into the form. However, it keeps saying,
[code]...
I am creating an application that needs to append textbox2.text as the <title> of a webpage.Here is part of the source of the webpage I want to interact with:<title>Test</title>How would I make textbox2.text take the value title (which would be test in this example)?
View 2 RepliesWebbrowser1.Document.GetElementbyId("idname").SetAttribute("value", Textbox1.text)
For Each element As HtmlElement In WebBrowser1.Document.GetElementsByTagName("input")
If element.GetAttribute("id") = "idname" Then
element.SetAttribute("value", TextBox1.Text)
End If
Next
there is as xsd file:
<?xml version='1.0' encoding='gb2312'?>
<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns="">
<xsd:element name="Alltest">
[Code]....
[Code]...
Now I find myself needing to do both Foo() and Bar() if value is "7" - is there a simple way to do this with an If condition?
[Code]...
I don't want to have to declare & initialize two lists if I can avoid it. Edit: I should have mentioned that this is a simplified example - there are actually a dozen or so CASE statements, and Foo() and Bar() are actually placeholders for quite a bit more code - it's seeing the same block of code repeated over and over that got me thinking about a better way to do it.