VS 2010 - Array SubString (of Sorts) / Making A Class That Represents A File?

Feb 24, 2011

Im making a class that represents a file. Im making a sub that reads data from one byte array into many properties. Now i need something that returns a byte array but only the first 4. Let me demonstrate because i can't think of a logical way of explaining. "something".substring(0,3) That would return a string containing "som" i need a function like that for a byte array


[code]...

Is there an existing function for this type of thing ? i've looked but didn't see anything that I understood.

View 2 Replies


ADVERTISEMENT

Making An Array Of A Class?

Oct 29, 2007

I was wondering if it was possible to make an array of a class. I made a class called creatures (for a game of course) and wanted to make an array of that class. So I tried "public creature() as new creatures", and it had a problem with using an array with new. Is there a way around this. All I am using the class for is variables. i.e.: in my class all i have is dim health, defense

View 12 Replies

Making An Array Through A File?

Dec 1, 2009

is there a way to make an array but instead of listing the things yourself, you open a text file with a bunch of words and use those?

View 3 Replies

Generic Class Array - Reading In A Excel File And Extract Data To Store In A Array

Sep 9, 2010

I want to reading in a excel file and extract the sCodenumber sDescription ans the sStatus and store them in a array : StatusComposeArray(5200) As MyCompose. After this I need this array for comparing outside this class. But as can you see the array is defined inside the sub: ReadingIn_ExcelFilesCompose [Code]

View 2 Replies

Use Substring On Array Items?

Feb 10, 2010

Il want to work with the array items from a split. The split works, after the split ill want a substring becouse I need only the first 8 numbers of the items. And i want to be sure its a number. Ill upload the file.

Private Sub MaakLijstMetWoordenDieBeginnenMetToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MaakLijstMetWoordenDieBeginnenMetToolStripMenuItem.Click

[Code].....

View 4 Replies

VS 2005 Separate The Array Into Two Parts By Using Substring?

Mar 8, 2010

I generated 10 integers in the array(9). Then I separate the array into two parts by using substring. But I just can't run the code, it has no error but cannot run.

Public Class Form1
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click

[Code]......

View 6 Replies

Search An Array To Select First Substring Containing Specific String?

Feb 21, 2010

I need to create a code that searches an array of movie titles. When the user enters a specific string, the first movie title that contains that string is displayed. For example, entering "he" would display Sherlock Holmes as opposed to the Blind Side. I don't know how to create a code that reads a string that the user enters.[code]...

View 2 Replies

Interface And Graphics :: Making A Custom Class That Mocks The System.Drawing.Rectangle Class?

Jul 6, 2010

I'm making a custom class that mocks the System.Drawing.Rectangle class because the Rectangle class doesn't have a name property. I need a name property because I am adding all of my rectangles to a collection and I need a little more info stored than just their locale and size. So I changed the _onPaint event but nothing is working out when I run the program?

Public Class Rectanglar : Inherits UserControl
Public BackgroundColor As Color = Color.Blue
Public Sub New(ByVal name As String, ByVal XY As Point, ByVal Widthy As Integer, ByVal Heighty As Integer)

[code].....

View 5 Replies

C# - Prepend A Substring If The Source String Does Not Begin With The Same Substring?

Oct 10, 2011

I'm trying to create a valid RegEx replacement pattern for correctly formatting specific .XML file names. Specifically, if a file name does not begin with a prefix, let's say, ACE_. If the XML file name and extension does not begin with ACE_, prepend the string ACE_ to the file name.For example, if my input source string is the following:

Widgets.xml

I would like to execute a single RegEx Replacement that would result in the string being:

ACE_Widgets.xml.

Conversely, if the string already begins with ACE_, I would like it to remain unchanged. Also,how can I include the pattern ".xml" to ensure that the string pattern for the file name and extension ends with ".xml" in the same matching pattern for the RegEx Replacement pattern? As for the match, I have some luck with the following:

^ACE_{1}[dD]+

Which indicates there is a match for the pattern if the input string is ACE_Widgets.xml and no match if the string is Widgets.xml
The RegEx pattern would suffice, but if you need to know the language in which I'd like to use the replacement pattern is in .NET 4.0 in either C# or VB.NET.

The following posting is close to what Im looking for, but with the inclusion of the *ix directory path prefix, and the use of preg_replace() in PHP, I'm having a bit of a struggle getting it to work with what I need to do:

Regular Expression: How to replace a string that does NOT start with something?

View 3 Replies

[2008] Richtextbox Substring - Select A Substring With 2 Criteria?

Feb 3, 2009

How will I select a substring with 2 criteria? I have a Richtextbox where I select a number after a : with this code; For Each line As String In Richtextbox1.Lines Dim equalsPos As Integer = line.IndexOf(":") + 1 txtFound.AppendText(line.Substring(equalsPos, line.Length - equalsPos)) Next This is working ok, but the whole line.length is appended for number2. The line ex. Some text:my number some text-my number2. I want my number appended to txtFound, and my number2 appended to txtFound2. With my code only number2 can be appended correct.

View 4 Replies

VS 2010 Making 'settings' File?

May 11, 2010

if we say i have a program and i want it to launch another .exe So the code of them being able to choose where it's located is "openfiledialog".But can i make it save the setting somehow, so it makes a small document/text-file thingy so it can read the locations from the file ?Or is there someway that the program remembers it ? I want it to ask for a file location first, and then next time pushing the button "start" it remembers the location ?

View 4 Replies

VS 2010 Making Backup Up File

Oct 9, 2011

how to make a back up file using mysql xampp?

View 1 Replies

VS 2010 - DataGrid Custom Class Array

May 14, 2012

I am working on a project which lets the user edit the students in a certain group using a datagrid. First I created a class called student and then I created a student-array. Displaying the students in a datagrid works fine. On form-load, I change the datagridview.datasource to the student-array. The datagrid has 20 rows by default (Public dbstudebt(0 To 19) As student). When I edit an existing student everything works fine but when I fill something in in an empty cell and press enter or tab to confirm and add a new student, it just clears the cell and nothing happens. So basically, editing existing studs in the datagrid works fine, making new student doesn't work at all as those cells are always cleared immediately.

View 4 Replies

VS 2010 ComboBox - Show A Number In The File I Am Making?

Jun 29, 2010

I am trying to convert watever is in the ComboBox to a number. So say I select "Grey" in the ComboBox I want it to show a number in the file i am making. My.Computer.FileSystem.WriteAllText(TextBox_ChooseFolder.Text & "" & TextBox_ItemID.Text & "-" & TextBox_ItemName.Text & ".sql",<ComboBox Number Here>, True)

I have tried

My.Computer.FileSystem.WriteAllText(TextBox_ChooseFolder.Text & "" & TextBox_ItemID.Text & "-" & TextBox_ItemName.Text & ".sql",If ComboBox1.Select = "Grey" Then "0" ElseIf ComboBox1.Select = "White" Then "1" ElseIf ComboBox1.Select = "Cream" Then "2" End If,True) ...I am new to Visual Studio!

View 7 Replies

VB 2010 Array/write Array To File?

Dec 3, 2011

I'm close to getting this to work, but currently can't get any output to display in the listbox. I had it working, but needed to move some things around to get the join function to work.In my program, a user enters input into a textbox and an array is displayed in a listbox based on what they type in. For example, if they type in "a", all foods (in the textfile that is connected to the program) that start with "a" will be displayed.

When there is output, I need to find a way to name this array (which is created based on what the user inputs) and join all of the items in the listbox (example: foods stacked on top of each other in the listbox will be shown at the bottom as a string).I am posting the code that I have thus far; all of the errors that I'm getting (and potentially my logic errors) are just in the first public class until the end of the first if-next statement:

Public Class frmFoods
Dim foods() As String = IO.File.ReadAllLines("foods.txt")
Private Sub btnDisplay_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnDisplay.Click

[code]....

View 1 Replies

VS 2010 Using Substring To Extract Paragraphs?

Aug 4, 2011

I have the following code which seems to work as intended.

From what i can tell is that Size is not the same as the amount of characters in a particular string, Is Size a size as in Bytes,Kilobytes etc?

Edit: Ive attached a PDF showing the output from this code. Which as you can see shows the wrong output and the sentence's go off of the side of the pdf.

So from what i can see is that tempPage.width (Which is 612) is some how wrong, because 612 characters goes off the side of the PDF Doc.

Public Sub writeParagraph(ByVal text As String, ByVal fontSize As Integer, ByVal align As Char)
Dim newPara As New paragraphLine(text, fontSize, xAxis, newFont)

[Code]....

This was working as intended but then i realised "What if it was possible to generate 1 paragraph at a time and then check the yAxis of the page and if it has been met or exceeded then continue to write the paragraphs on a new page".

Im having a blank brain day lol , I cant seem to work out the correct calculation to extract each paragraph 1 at a time and add it to the arrayList.

View 8 Replies

Using Modules - Program That Uses A Tabcontrol - Each Tab Represents A Collection Of Common Tasks

Nov 26, 2011

I have a program that uses a tabcontrol. Each tab represents a collection of common tasks and, as one would expect, has a bunch of controls on it.

In my original version of this app, I simply put all functions/subs/etc related to a specific tab right in the main form class; I just divided them with lines and a few extra blank CRLF so I could jump from section to section within the code (literally named Tab1 Code, Tab2 Code, and so forth).

I am re-working the program and thought I'd use modules for this instead. So, I built all the forms and grabbed the code from the previous version, created a new module, then pasted the code into the module. VB.Net 2010 has choked all over this with a zillion errors. The functions/subs are all public, but they cannot see any of the controls on the main form. Every control that is in existence on the main form comes up as being not declared in the module.

This is the first time I've tried to use a module without a full class, and the first time I've tried referencing back to controls on the main form in this fashion (I've always just used it for functions/subs that I pass data to). Am I trying to do something here that shouldn't be done or...? I basically just want to create files so I can segregate the code into a more logical design.

View 4 Replies

Reach A Substring For Each Row From A Txt File?

Mar 11, 2009

I have created a program which opens a file, eliminates the delimiters and save the info into another file.What I need is to reach a specific numbers of characters in the string (which is between 14 and 19 and tells us the date) and to compare it with the current date. If the date is equal or later than today's date , save all lines in to another file. Pease help me to walk through the string and get the substring and finally compare with the current date.

[Code]...

View 2 Replies

File I/O And Registry :: Pasing A Sentence With .Substring ?

Nov 16, 2008

I am working on creating a program for my Visual Basic Programming class, and I have hit a snag. My problem is that we have a text file that lists the countries of the world, along with their population, area, capitals, etc. Well, each country is listed as one line, with all pertinent information following on that line. Some information is unneeded, like the Capital or the Continent. I have set up my variables for each piece of the line, and am planning on using a Do While (sr.Peek <> -1) Loop to read through the list.

My problem arises with .SubString. I can get it to parse the first word just fine by saying

Code:
variablename.Substring(0, n)
n being my variable for finding the .indexof the blank space.

After the first word, I can't seem to get .substring to parse any words or data from the file after the first word.

Code:
Option Strict On

Public Class Form1

[CODE]......................

View 3 Replies

Parsing Lines Of A File And Replacing A Substring?

Jul 19, 2011

[code].....

View 2 Replies

SubString From Text File Load To GridView?

Jan 27, 2011

xxxx,2222,3333,44444,5555555ab,6666666,500000,500000,Haaaa
How to substring it step by step load to gridview?

View 5 Replies

Write To A Text File In Substring Layout?

Nov 9, 2011

I have made the first part of this application it read the file and splits it up, injects into SQL where it pulled and edited. Now i need to create the part of the application that Exports the data back to the orignal layout. I have used Substring to read the infomation as it was the only simple way i could think of.

Example of the layout is below.

HEADER 29112055553378JOB COMPLETIONS
1 HSG885398 0 HS1 EP0 1.00 1.00 14.30
2 HSG885398 0 HS1 01 1.00 1.00 60.89
3 HSG885398 0 HS1 HS03 1.00 1.00 7.82

[Code].....

View 3 Replies

VS 2008 : Making An Array = Another Array?

Nov 2, 2010

I have 2 arrays, tile(13,6) and loc1tile(13,6). Is there a way to make the values in loc1tile(13,6) equal to the corresponding values of tile(13,6)?Do I have to do it like this?

loc1tile(0,0) = tile (0,0)
loc1tile(0,1) = tile (0,1)
loc1tile(0,2) = tile (0,2)
etc.....

View 7 Replies

Making A .dll From Class.vb Files?

Mar 10, 2009

I am using visual studio express edition 2008. I am trying to move my class.vb files in my web application to one .dll. I used visual express edition 2005 earlier and I had to add to import the below code to get it to work. Now in 2008 edition I get a whole new error and I need to know what I need to Import. Code is below

2005:
Imports Microsoft.VisualBasic
Imports System.Configuration
Imports System.Web

When I do the above in 2008 I get the following errors:

Shared mainconnection As
New Data.OleDb.OleDbConnection(ConfigurationManager.ConnectionStrings("connectionstring").ConnectionString)
Error: Error 1 Name 'ConfigurationManager' is not declared.

[code]....

View 1 Replies

VS 2008 Adding Class Object To List Or Array In A Different Class

Jun 21, 2010

I am trying to create an list or an array of a class.Here is my "Ingredient" class that I am trying to create a list of:[code]In my "recipe" class, I am want to create a list (or array) and I am drawing a big blank on how to do it. Can anyone point me in the right direction?

View 2 Replies

.net - IComparable - Call Different Sorts?

Aug 17, 2010

I have a DTO that I am using to process transactions. To ensure that it is processing in the correct order, I am using iComparable and sorting the List(of T) of the DTO. That works great. However I just got another requirement that the customer wants the output in a different order... is there a way to allow me to have two different sorts for the same object, or do I need to copy the current class, save the output as a new List of that type and sort using the new way for that object?

View 2 Replies

List(of T) Custom Sorts In VB

Oct 13, 2011

Im converting a winforms application and it has gone smoothly except for trying to get custom sorts for generic lists working.

VS 2010 ASP.net 4.0

I have my classes in App_code but it fails to work like the winforms version.

Dim ReturnList as List(of Quotedata)
ReturnList.Sort(New SortQuoteDateAscending)
> Unable to cast object of type 'SortQuoteDateAscending' to type 'System.Collections.Generic.IComparer`1[Quotedata]

Is there a gotcha with asp.net implemenation of custom sorts in asp.net 4.0 or am I missing something.

Public Class Quotedata
Private m_quotedate As Date
Public Property QuoteDate() As Date

[Code]....

View 3 Replies

Multiple Sorts On List<Of T>?

Apr 1, 2011

I am using VB.NET and .NET framework 3.0I am currently sorting a list like this: lstPeople.Sort(Function(p1, p2) p1.LName.CompareTo(p2.LName))However, now I want to sort by FName as well after the LName. So it sorts first by last name and then by first name.

View 3 Replies

Making A Blackjack Game For Class?

May 2, 2011

I'm making a blackjack game for class. It's been better programming in VB than it has in C#, but I don't know how to link button subs (BTN_Deal_Click or BTN_Deal; I can't decide which one will work) to one another. For example, after the code in BTN_Deal has been run, the program is supposed to wait for the user to click either the Hit or the Stand button.

[Code]...

View 2 Replies

Making Variable Class With Event?

Jun 22, 2010

I haven't quote grasped this whole "class" concept yet, but I'm working on it. When following the instructions below, the "test" portion of this code: "test.variable". It has an underlined error that says that "test" is not declared. If I remove the "test" word then the ".variable" shows not declared. I'm using Visual Studios 8 if that makes any difference. I have a pre-existing variable in a project that I would like to monitor for changes.

Re: Detect variable change.
Make your variable a class with an event.
Make your class:
VB.NET Syntax (Toggle Plain Text)
Public Class myVar
Private mValue As Integer
Public Event VariableChanged(ByVal mvalue As Integer)
[Code] .....

View 1 Replies







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