Change Structure Of Code?

Aug 27, 2010

How do I change the program path '"logic.txt", "G:"' in the code below to the OpenFileDialog.FileName? Cos when I tried it, I receive String conversion errors and I tried altering the codes but it didn't work out well. [code]...

View 1 Replies


ADVERTISEMENT

VS 2008 - Run Function Or Sub At Structure Change

May 11, 2010

I have a question: How can I make a function or sub run inside a structure when a variable in this structure changes? As example I have this function:
Public Structure Texture
Sub New(ByVal TexturePath As String)
Me.Path = TexturePath
Me.Image = LoadImage(TexturePath)
End Sub
Public Path As String
Public Image As Image
End Structure

And somewhere this happens:
Dim t As New Texture("path ooldfilename.tga")
t.Path = "path o
ewfilename.tga"
I want it to automatically load the image when the "Path" variable changes. Is the only solution making an extra sub and run that? It would really decrease my code size if it changes on variable change.

View 3 Replies

Apply Change To Instance Of Structure Within Array?

Nov 5, 2011

So I have an array which holds instances of a structure. The structure contains various string properties.

I'm looking to modify each instance of a structure within this array by doing the following:

For Each stuInstance As StuInstance In arrStuInstances stuInstance.strCarName = "Benz"

But I found that this in fact fails to really change it permanently. If I do the following loops in the given order:For Each stuInstance As StuInstance In arrStuInstances

[Code]...

View 2 Replies

Structure Values Change In Multiple Places?

Mar 21, 2009

I have created two structures, one named "Product" and the other named "Item". These structures are quite similar but are at the same time quite different from each other. The structure definitions are as follows. Ultimately, I declare arrays in my containing class which access these structures as a type. Their declaration: "Products() as Product" and "Items() as Item". All has been fine and dandy until one day, I go to change the items Enabled() values, and something happens. Not only does it change the Items(index).Enabled(index) value, it does it on the corresponding Products(index).Enabled(index) value, even though it was never specified to do so. Also, nowhere in my coding have i defined this sort of thing to occur. It is rediculous, because I watch it happen. I turn on the watch window, and debug one step at a time, and every time, I watch the Item line step, I look down at the arrays of products and items, and both values have changed. How do I get this to stop, and only change the Item.Enable value??

<Serializable()> _
Public Structure Product
Public Name As String

[code]......

View 2 Replies

Code An Array Of Structure?

Mar 26, 2009

I am once again struggling with my weekly project. I am assigned to write a program that converts a predetermined english sentence to both french and german. The code is to contain an Array and a structure. Also we have not covered retrieving array data from a TXT file, so we are to hard code in the array data. I coded the structure and the array, I added the array data, but am confused how to access the data. The examples I have found all deal with retrieving data from a TXT file. Can someone give me a nudge in the right direction.[code]....

View 3 Replies

How To Return A Structure-VB Code

Mar 13, 2009

I am trying to return a structure from a class.vb file to an aspx page. Is this possible, if so how would you do it in the aspx page and the class.vb file?

View 1 Replies

How To Structure Code Properly

Jan 28, 2011

5 records to add

Try
Do While
Insert Statement

[code]....

When i get an error concerning duplicated values found, it just catch the sqlexception, display a message and exit try. But i want it to continue adding the remaining record even when a record of duplicated values is found.

View 10 Replies

Handling Long Strings - Change The Query / Structure And Test It?

Jul 9, 2010

I develop in VB and often I'm writing long TSQL statements in SSMS but getting them into VB is a bit of a pain. I like SSMS during development because I can change the query / structure and test it when there are problems. Some of them become stored proceduresand some of them I just keep in the code.

I like keeping them in the code because when I have a problem with something, I can GREP my projects directory and find the code that does something (that I've forgotten) or someone asks something about how something works, I can look it up. I've yet to find a GREP for stored procedures. Is there such a thing?I've read in a "best practices" white paper how we're not supposed to concatenate super long strings with & _

[code]...

C# handles these things much better than VB. I'm wondering how I can keep my code together during development and searchable later. I had my hopes up when VS 2010 offered implicit line continuation, that this would help my multi line SQL procedures.Again, I was mistaken. Perhaps I could write it all on one line. I'd be interested in knowing if there's a feature that I am not aware of. Well there are certainly many features which I'm not aware of, but I was referring to "long strings".

View 2 Replies

VS 2008 Vending Machine Using Structures - Calculate The Change From The Structure

Aug 23, 2009

I'm having a little trouble working with structures and using a counter for the same structure. my structure gets its data from a text file which i readoff and assign ok. Here's part of my code

[Code]....

View 9 Replies

Microsoft - Code Comment Structure

May 18, 2010

What is the Microsoft Standard for Code Commenting

1. In case of Class 'Class header Comments

2. Function Comments

3. Subroutine Comments

There are different ways to comments like XML Documentation using ///

CODE:

Which Stnd should follow? May be something else other than above?

View 1 Replies

VS 2005 Changing Structure Of Code?

Jun 24, 2009

How do I change the program path '"logic.txt", "G:"' in the code below to theOpenFileDialog.FileName? Cos when I tried it, I receive String conversion errors and I tried altering the codes but it didn't work out well

vb.net
Sub Button1Click(ByVal sender As Object, ByVal e As EventArgs)
Dim sb As New StringBuilder(260)

[code]......

View 1 Replies

Speeding Up Code That Copies Database Structure To XML

Aug 23, 2010

I have a database structure filled with data that I'm trying to write out to an XML file. Here's a taste of the way the VB code is structured:[code]I can't see or report any progress, because the processing is all tied to one giant LINQ query. Even if I can't make it any faster, I'd like to know how much longer I have to wait. My first version of this code had For loops instead of queries, so I could display progress, but it took a loot longer.Obviously I'd like to speed this up considerably. It seems like there should be a simpler way to convert the data to an XML file, especially since the database structure was created from the XSD in the first place.

View 1 Replies

Write A Short Program - Structure The Code?

Feb 2, 2009

I'm trying to write a short program to for work but I'm not quite sure how to structure the code. This is what I currently have;[v
I'm pity sure this is majority the wrong way to structure it as at crashes with the IF/ELSE field going up to around 50000, but it does work (if a little sluggishly) when set to 5000.[code].....

View 13 Replies

DB Access Code - Copy Just The Structure Of The Tables And Not The Data?

Mar 13, 2009

Here is the:

Imports System.Data.OleDb
'Add reference to Access then
Imports Microsoft.Office.Interop
Imports Microsoft.VisualBasic

[CODE]...

I am using this to copy tables in an Access database(2003). the questions I have are:

1. How can I make this more 'obejct oriented'?

2. How can I copy just the structure of the tables and not the data?

(Currently both are occuring)

View 3 Replies

Fill Fields In A Structure In A Single Line Of Code?

Sep 21, 2009

Just suppose that I define a structure, and an array such as

Structure Person
Dim First_Name as String
Dim Last_Name as String

[code]....

Can I fill in my list of people using a single line of code for each record? Something like this, it doesn't work, but this shows the sort of thing I mean.

My_List(0) = {'John', 'Smith', 24, '555-1234'}
My_List(1) = {'George', 'Jones', 31, '555-8123'}
My_List(2) = {'Tom', 'Green', 40, '555-3434'}

It's easy enough to fill it in line by line. I could do that without problem. But I want to be able to look at the code and see the contents of each line. Doing it as above would make it easier to read.I could make it a multidimensional array of strings, rather than a structure.If it makes any difference I'm using Visual Basic 2005 Express Edition.

View 8 Replies

VS 2008 : Code To Write And Read Structure To Text File?

May 10, 2010

i have the code bellow to write a structure to a text file, but nothing is happening,how can i get a error message if the file doen't exist?

Imports System.IO
Imports System.Runtime.Serialization.Formatters.Binary
Public Class Form1

[code]....

View 1 Replies

Setup DataTableAdapters To Allow For Easy Code Change When Change Server Names?

Feb 20, 2012

I'm getting familiar now with using the Dataset Designer and how it makes for quick and easy updates and query of tables. I use to use the OleDB commands and leave the Connection String as a Global Constant so I can easily change it if the server name changes, or if we have to re-direct the .NET to another instance of the database.

But now that I use the Dataset designer I'm concerned that I maintain flexibility and support in the long run. how the Dataset designer works and where it stores it's connection string info? And how difficult that would be to update. It looks like I modify the App.config file, but I'm unfamiliar with this.

What am I getting myself into? It looks like a standard XML file. Is that it?

View 1 Replies

How To Change Server.Transfer Code To PHP Redirect Code With Member Id

Sep 18, 2010

I have a code in VB that looks like this:'Server.Transfer(txtUser.Text + "_page.aspx")which is taking a forms authenticated user to their page. For example if John logs in, it will take him to john_page.aspx.How will I be able to integrate this in a PHP login script?I'm trying something like:header("location: $member ._page.php");but I don't think I'm doing this correctly.

View 1 Replies

Structure Inside Another Structure Receives Null Reference Error?

Jan 5, 2012

Module Module1
Public Structure structure1
Public TRANS() As structure2
End Structure
Public Structure structure2
Public X() As Integer
End Structure
End Module

View 17 Replies

Change My Code # To Code In All The Text Files Within A Folder?

May 20, 2012

How can I change my code # to Code & in All the text files within a folder

View 10 Replies

Class Structure - Large Structure That Has Lots Of Properties ?

Jan 5, 2010

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.

View 11 Replies

Converting Structure Within Structure To Byte Array For Socket

Aug 29, 2009

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]....

View 2 Replies

Invalid Structure Size When Marshalling C Structure To .NET

Apr 14, 2012

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.

View 1 Replies

VS 2008 Convert The XML Structure Into A Class Structure?

Apr 25, 2010

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]....

View 2 Replies

Arraylist Of Structure Within Array Of Structure?

May 23, 2010

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]......

View 13 Replies

Assign Array Of Structure To Another Of Same Structure?

Oct 12, 2010

In Vb.net I am trying to assign an array of structure to another array of same structure[code]...

View 2 Replies

.net - Change C# Code To Vb?

Mar 27, 2012

public void ChangeList(IEnumerable<LineInfo> newLineList)
{
if (InvokeRequired)
{
BeginInvoke((Action<MainForm, IEnumerable<LineInfo>>)((t, e1) => t.ChangeList(e1)), this, newLineList);
return;
}
}

View 4 Replies

How To Change A Code

Jun 18, 2010

I would like it to be a save file code not save as.

Dim Save As New SaveFileDialog()
Dim myStreamWriter As System.IO.StreamWriter
Save.Filter = "*.HTML|*.HTML|All Files *.*|*.*"

[code].....

View 6 Replies

Change A Few Lines Of Code From CS.NET To .NET?

Mar 23, 2011

Basically I'm trying convert the following....

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

[code]....

View 3 Replies

Change The DPI Of The Image To 72 Through Code?

Aug 18, 2010

I have an image scanned in 300 dpi. I want to change the DPI of the image to 72 through code. Seems there used to be a function called Image.SetDPI, but I cannot find it anymore. All I can find is Image.SetResolution(xDPI, yDPI), but that actually changes the SIZE of the image, meaning it cuts out a portion of it, without changing the DPI. Anyone know what function will accomplish this in Visual Studio 2008?

View 2 Replies







Copyrights 2005-15 www.BigResource.com, All rights reserved