Annotating Some Code And Understanding What Arrays Are Doing?
Dec 1, 2011
I wanted to know what the main areas are and what the array is actually doing in the code. I know that dim is declaring the variables, but how do i exactly explain this code line by line.
PS: the areas in red are the main areas im trying to understand annotate.
Public Class Form1
Private Sub Label1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Label1.Click
End Sub
[code]....
View 4 Replies
ADVERTISEMENT
Mar 25, 2010
Is there a way to annotate functions, subs, properties, and methods so that tool tips will pop-up in the IDE as they're being defined or selected?
View 2 Replies
Dec 2, 2010
i am having problems trying to code this application, here is the assignment: Amusing Toys, Inc. wants to store the description and the number of items on hand of its toys in a sequential access file named stock.txt. The company's sales manager wants an application that lets the user enter the descriptions and the inventory in tow list boxes. Then he also wants to retrieve the file so it is possible display the inventory of a toy whose description he selects from a list box. The List box with the description should appear as soon as the application is loaded. Create an application which: initially adds the information to list boxes so the information can be checked, places the data in one or two arrays, saves the information for retrieval later, contains test data for at least 10 items.here is what i have so far i cant get the information to line up correctly in the list box from the text file and also i have no idea on how to get the quantity to show up after i get it to line up correctly i think i need an array.
Public Class MainForm
Private Sub addItemButton_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles addItemButton.Click
Dim heading As String = "Department" & Strings.Space(2) & "OnHand"
Dim description As String = String.Empty
[code]....
View 3 Replies
May 21, 2012
To write code to implement data from visual basic into excel. Write a VB.NET program to store the following numbers into an array named �Scores�: 89.5, 76.2, 90, 86, 81, 97, 61, and 73. Your program will calculate an average score, list each of these scores in a new Excel workbook and show whether each score is below or above average. Your program will then save the Excel workbook as TestScores.xlsx.
In column A1 it should say "average" and next to it (in b1) should have the average of all those scores. in the cells below (starting from A3) it should list the scores and the column next to each score it should say whether each score is above average, average, or below average (compared to the average calculated in cell b1)
View 2 Replies
Dec 25, 2011
I need help to form a code for a small arrays manipulation. The input data are known: they are two integers "N" and "s". An integer "N" is always divisible by 4.I need to create an array of "N" members, by repeating (N/4 times) this sub-array: 1,2,2,1 (always is the same). In the picture, this is shown in blue. Then I need to add the same array to the existing array, but shifted for "s" places (red array). The result is "yes" if each sum in new columns is always the same (3). Otherwise the result is "no." note there is no need to draw or display something (DGV, table ...). The required result is only "yes" or "no".
View 8 Replies
Aug 7, 2010
I have this code to set array values and store them in a variable,
Dim productName As String()
Dim productPrice As String()
Dim productCategory As String()
[CODE]...
How do you get the variable values to output like this?
<input type="text" value="Chang Beverages $19.00" id="Chang" /><br />
<input type="text" value="Ipoh Coffee Beverages $46.00" id="Ipoh Coffee" /><br />
<input type="text" value="Gula Malacca Condiments $19.45" id="Gula Malacca" /><br />
View 2 Replies
Apr 29, 2011
I am writing an application that has to read and interpret data stored in some PDF files. The reading part is done but I am only able to get a dump of all the words on a page and not the format of the words. What I mean is that if I have to extract a table, I am getting the numbers in the table but not the markup which defines the table.
Further, there is some formatting used which displays a few of these numbers within parentheses (meaning that those numbers are negative) but the parentheses themselves are not part of the text. Hence, I am not able to distinguish between positive and negative numbers present in the PDF table!
How do you get the PDF markup along with the text? Is a PDF similar in structure to an XML with tags used to markup tables etc.? If not, then, is there a resource which describes the salient features of the PDF DOM? I am using VBA and the Acrobat library (AcroExch etc.)
View 4 Replies
Dec 7, 2009
I am trying to use my first predicate and I generate the error:Method 'Public Function FindIndex(list As MyProgram.HTMLFiles) As Boolean' does not have the same signature as delegate 'Delegate Function Predicate(Of T)(obj As String) As Boolean'.[code]
View 12 Replies
Mar 15, 2010
I have this RichTextbox in my vb.net form and I would like to when a user click a button, for example to embold the selected text, how would I do this.Also, I do NOT want to use the standard vb.net expressions such as RichTextBox1.SelectedText.Font.Bold = true. I want to do something like RichTextbox1.SelectedRTF="[bold]" & RichTextBox1.SelectedRTF & "[/bold]" or whatever RTF looks like.Can I just add the RTF options random places or can a RichTextBox return an error if the text is in wrong format. I'm mostly looking for info on how to work with RTF without using the standard vb expressions.
View 1 Replies
Jun 16, 2010
My goal is to read a data streaming from a machine the streaming is divided in tre main parts,the first is a 10 byte array that declare the length of the second and third part.The second one, the header, is a 22 DWORD (*32bit) ( 88 byte ) structured of mixed data types.I can easly read the value inside this header when the DWORD contains just one information using something like: [code] My problem starts because some of these DWORD contains several indipendent informations, for example DWORD #4 [ channel 2 peaks 31..16] [channel 1 peaks 15..0].For what I understood the first 16 bits ( so 2 bytes) are used to store the information of the first channel , while the second 16 bits are used for the second channel, I tryed converting the first 2 byte with System.BitConverter.ToUInt16()but without success.Can someone explain me what to do and how these numbers are supposed to be stored?
View 6 Replies
Dec 14, 2010
so i have a class called FOOTBALL,then another 3 classes/forms that inherit FOOTBALL, they control score (SCOREBOX), possession (POSSBOX), and quarter (QUARTERBOX).the FOOTBALL class has 4 variables, "score" (array of 2 ints), "teams" (array of 2 strings), "possession" (boolean), and "quarter" (int)after that i have another form called MAINBOX, which creates new instances of the 3 classes (SCOREBOX, POSSBOX, and QUARTERBOX) (like this: private scoring = new SCOREBOX)... however they all technically create their own FOOTBALL classes, so I cannot connect them.
View 4 Replies
May 29, 2009
I started out with VB.NET but now mostly do C#. I never really got to grips with events in VB. I'm trying to translate an old VB.NET program (from 2002) into C#. I've dealt with everything apart from statements such as these:
Public Event UpgradeProgress(ByVal strProgressString As String, _
ByVal strCurrentFile As String, ByVal intProgressPercent As Integer, _
ByVal lngTimeRemaining As Long, ByRef blnCancel As Boolean)
[code]....
View 4 Replies
Feb 27, 2010
It is my understanding that in .Net 4.0, VB will have an in-memory compiler.
I have to admit I don't know a lot about the compilers so I'm trying to understand the advantage of this as compared to what we had before this. Also, will C# be coming out with the same type of compiler?
View 2 Replies
May 25, 2012
I'm confused on the results of this code. The results extracts the tag "div" but why isn't the results containing the word "Yoga"? Shouldn't the result have only one element because it should exit the for loop after finding the first element? The results show hundreds of elements
Dim ElementCollection2 As HtmlElementCollection = WebBrowser1.Document.GetElementsByTagName("div")
For Each curElement As HtmlElement In ElementCollection2
[code].....
View 4 Replies
May 9, 2010
In VB6 I load a recordset containg all of the records (6 fields per record)in a table into an XArray and then manipulate the records in the array and then write them back to the original table. The array issorted by the first field (1 to maybe 8000 or more) I need to find records in the array by an ID field and then move them (because of some external criteria that happens many times) from say number 400 to number 375. Then all of the other records between 375 and 399 were renumbered up 1 to fill the gaps left by the move.
The XArray worked well as it could find and also move to a next record easily to facilitate the revisions to each record quickly. Everything is done in VB6 in code and nothing visual needs to be shown to the user until say 2000 of these external changes are complete. What is the best, most efficient way to do this in the .Net framework in VB2010. Datasets, Dataviews. tableadapters, arrays. enums ?
View 3 Replies
Dec 28, 2011
If i have a class called A and a class called B, if B inherits A that means A is the super class and B is the subclass. I have been asked to describe why class A is not an abstract class but as i see it class A is an abstract class A, as it has been created for Class B to use in the future, is it something to do with Class B not being able to access the fields in Class A as although they are private by default?
[Code]...
View 3 Replies
Nov 4, 2010
As far as I understand from the docs, it seems that Application.Run() starts a message loop on the current thread, which in turns enables it to process user input (Is that right?).The overloaded version Application.Run(Form) basically does the same, only it exists when the form closes, and it shows the form by default.timer ticks after 20mns, and has to execute say approx. 15 tasks one by one, every time creating an instance of a progress dialog, initially hidden in the taskbar.
View 1 Replies
Oct 5, 2011
Looking at the following code snippet in VS2008 (this is from the SBS book)
Dim HumanAge As Integer = 0
If HumanAge <> 0 And 7 / HumanAge <= 1 Then
MsgBox("1 dog year or older")[code]....
I expect to get a runtime error, because And evaluates both conditions, which is why in this case AndAlso should be the better operator to use. When I try this code there is no difference in behavior between 'And' & 'AndAlso'. In neither case I get a
runtime error, not even when I flip the conditions around. Is this by design, a lucky accident, or do I just not get it?
View 5 Replies
Jun 14, 2010
UPDATE: See the bottom of this question for what I did to solve the problem.I'm trying to understand how the ItemsSource and DataContext properties work in a Silverlight Toolkit DataGrid. I'm currently working with dummy data and trying to get the data in the DataGrid to update when the value of a combo box changes.
View 2 Replies
Aug 24, 2010
I have a situation in a program I'm writing where I'm not sure of the best way of coding a couple of objects and was hoping for a few pointers.I am using VB.NET 2003, so F/wrk v1.1. My business is horticultural in nature and I'm trying to help streamline the business with a new order fulfillment app.In my program, I have products. Some products don't have any component parts, but others are made up of a selection of plants.For example: we sell a trowel, which obviously doesn't have any component parts. But we also sell a large vegetable garden, which is made up of, say, 20 rocket plants, 30 salad plants, 5 spring onions, etc.[code]I believe the ProductContents table is technically referred to as a 'join table'?
I have written the classes in VB.NET which load, save, edit the Products and the Plants. I also have Manager classes which store collections of these objects (ProductMgr, PlantMgr).I have dealt with situations before with join tables where there are only two columns which are both FKs and both make up a composite PK (ie - to express a one-to-many relationship). This is pretty straightforward (using my product/plant tables as an example) because when I load an individual Product from the database, I also run a second SELECT query which returns any PlantIDs associated with that PlantID from ProductContents. I store that in an array of integers within the Product object. I can then load Plants from the PlantMgr object based on the PlantIDs stored in this array. I kind-of do the reverse when I save the Product to the database, I run a second INSERT query which updates the ProductContents table with the Plants associated with the Product.Where I'm getting stuck is with the inclusion of the extra 'Quantity' column. I can no longer store the PlantIDs in an array of Integers because I also need to store the Quantity associated with that Plant. I also can't use the PlantMgr object any more (to express which Plants are in each Product) because it also doesn't include any information about Quantity.I was just wondering if there is a standard way of handling this kind of situation, where I have a 'join table' which also includes extra columns as well as the two columns that identify the join.
View 1 Replies
Apr 3, 2012
I'm trying to figure out why the following VB.Net code seems unable to upload a file to my ISP's FTP server, since it doesn't report any error but I'm not getting the notification e-mail I'm supposed to receive once a file has been uploaded.So I launched the free Fiddler proxy on 127.0.0.1:7777, but it doesn't report any activity, even with its "Capture FTP Requests" option checked:[code]Is there a way to watch the FTP session to understand why the file seems to be uploaded successfully but I'm getting no success notification?
View 4 Replies
Aug 15, 2009
a member mentioned, xml is similar to a txt file. txt files, i can manipulate quite well. so, if this is the case, it should not be to complicated to do as the thread title describes . that, of course is, if you already know how to even create an xml file. i do not. any and all input/suggestions welcomed, links for xml noobing welcomed as well.
i like: VB General google fast cars username password
View 11 Replies
Nov 27, 2011
I am working on a project, but the latest enhancement to it has me stumped currently. Here is what the class enhancement asks for:
Modify class time to provide a Tick method that increments the time by one second. Also provide methods IncrementMinute to increment the minute and methods IncrementHour to increment the Hour. The Trick method, the IncrementMinute method and the IncrementHour method should be called when you click the Add 1 to Second button, the Add 1 to Minute button and the Add 1 to Hour button, respectively. Be sure to test the following cases:
A) Incrementing into the next minute.
B) Incrementing into the next hour.
C) Incrementing into the next day (that is, 11:59:59 PM to 12:00:00 AM).
Here is my GUI:
The reason I am confused is currently my program already increments the seconds, minutes, and hours correctly (as shown in pic) for Cases A, B, C. But, I haven't added a Tick method which is what the enhancement to the class Time calls for. Here are the 2 classes I have so far:Time Class that the Tick method is supposed to be added to
Public Class Time
' declare Integer instance variables for the hour, minute and second
Private hourValue As Integer ' 0 - 23
Private minuteValue As Integer ' 0 - 59
[code]....
View 2 Replies
Dec 10, 2009
My assignment is to have a user enter in big integers using what i think is two parallel arrays. I got this far but now im stuck. I think i need to actually convert the text box input into an array but i do not know how to do that. I am all over the place in this project.
'Created/ Revised by: Jessica Falcetta
'Cap 204 Final Project: Big Integer Project
'Project Purpose: To calculate large integers through parallel arrays
[CODE]...
View 5 Replies
Feb 2, 2010
I have a VB.net console app and I am opening a function in a dll written in fortran. I am passing 3 arrays through the function by reference. When they come back out the otherside they ahve all tunred to arrays of only one element And that element is 0.I read on the internet somewhere that when doing this kind of thing it is a good idea to only pass the first element of the array into the function.I tried changing my function declaration to accepting single elements rather than single dimensional arrays, and now the arrays are the same length before and after the function call, but they don't seem to be changing at all, so i'm not sure that this is working
View 1 Replies
Mar 17, 2010
I am using AddHandler to wire a function to a control's event that I dynamically create:
[Code]...
This code is generating a run-time exception stating: Unable to cast object of type 'MyEventHandlerDelegate' to type 'System.EventHandler' What am I not understanding about System.Delegate even though AddHandler takes as an argument of type "System.Delegate"? What Type does "EventHandler need to be to cast to a type that AddHandler can accept?
View 3 Replies
Jan 12, 2011
How to determine when floating point limitations will cause errors in your calculations. For example the following code.
CalculateTotalTax = function (TaxRate, TaxFreePrice) {
return ((parseFloat(TaxFreePrice) / 100) * parseFloat(TaxRate)).toFixed(4);
};
I have been unable to input any two values that have caused for me an incorrect result for this method. If I remove the toFixed(4) I can infact see where the calculations start to lose accuracy (somewhere around the 6th decimal place). Having said that though, my understanding of floats is that even small numbers can sometimes fail to be represented or have I misunderstood and can 4 decimal places (for example) always be represented accurately.
MSDN explains floats as such... This means they cannot hold an exact representation of any quantity that is not a binary fraction (of the form k / (2 ^ n) where k and n are integers). Now I assume this applies to all floats (inlcuding those used in javascript). How can one determine if any specific method will be vulnerable to errors in floating point operations, at what precision will those errors materialize and what inputs will be required to produce those errors?
View 5 Replies
Jul 23, 2010
I have this code for an ownerdrawn list box that is repainting too frequently. It seems to be related to trying to scroll an event with a different height than normal. Here is the 'smallest code to reproduce the problem' that can be pasted into a blank form (erase the designer file) - VB version (c# of course does the same thing):
[Code]...
View 3 Replies
Sep 19, 2011
I'm working with an eprom emulator in trying to understand the command string write instructions. Here is what I have. [code] From what I know, the values in hex need to be converted to decimal first. What I'm not sure about is the checksum value needed. The instructions say Checksum =(1 byte truncated addition of all the above).
View 4 Replies
Oct 30, 2010
the statement Dim state(49) As String and maintain a list of certain states. The list of states should always be in alphabetical order and occupy consecutive elements of the array. The buttons in the program should give the user the following options: (a) Take the state specified by the user in a text box and insert it into its proper position in the array. If the state is already in the array, so report. (b) Take the state specified by the user in a text box and delete it from the array. If the state is not in the array, so report. (c) Display the states in the array. "
Private Sub states_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
state(0) = "Alabama"
[code]....
View 1 Replies