How to make an ArrayList in C# - arraylist

I'm a beginner in C# and I just have to have some tasks for my teacher to continue moving on.
I kindly ask someone for assistance:
I have to write words in the console until the word 'end' is entered, and that's ok, but, I'm kinda lost when the program has to enlist words that are beginning with letter A, then in the next line words that initialize with letter B and finally with the C. After that it has to writeLine The Other Words.
Now, I have some pretty messy beginner code, and I don't think it would be much of a help, but I would appreciate if somebody even gives me a hint or an idea in what direction to think.

This example may help. It is not an ArrayList but because an ArrayList is a type of list, the pattern should hold true.

Related

Output of mathematical function in vba

I am a complete novice when it comes to vba but I want to help a friend out, so I could use some guidance with a problem. I figure something like this is on the internet already, but I cannot find it, so if you have a suggestion as to where I could look, I would appreciate it.
I have a vba project with 19 modules, which compiles with no errors or warnings. The program calculates economic rate of return, given certain events. All the results come out as they should, apart from a single one. I am all but certain, that there is a mathematical flaw with this particular input, but I cannot locate it. This leads me to my question:
How can I obtain output from a (mathematical) function defined in vba? Preferably for discrete values of time, but at this point any help will do.
Simply call it. You can do it from a cell in a spreadsheet:
Assuming the function is called myMathematicalFunction and takes one parameter:
A1:
=myMathematicalFunction(B1)
B1:
<input value to test>

Editing contents of a labview array

I'm trying to increment specific elements by 1, in order to log results as they come in. I'm trying to read an element, add 1 to it, and then write it back to the same memory address. Why isn't this simple?
In code it would be something as simple as;
array1[element1] = (array1[element1]+1)
or
array1[element1]++
Arrays seem to be either read (indicators) or write (controls)? This is really frustrating, and there's very little help online.
You can use an "Array index/replace" element inside a "In place element structure":
You should use ReplaceArraySubset in the Array palette. For simple replacements, it's much faster than the In Place Element Structure
As an infrequent, novice Labview user I have the same problem ... until I found the code that I used 10 years ago. Surely the answer to sgccarey is:-
Right click on the array control or indicator and 'create local variable'
This variable will appear on the block diagram and can be set as 'Change to Write' or 'Change to Read' as necessary to use as the input and / or output array to a simple 'replace array subset'.
This way the array data only appears once on the Front Panel and is updated as required.
I have no idea if using Local Variables affects runtime efficiency but it works for me. Hope this helps.

Word VBA - Load part of doc into variable, and run .indexOf to search

Okay, I am a Javascript programmer and VBA is driving me insane - I know nothing about it and it is like pulling teeth to find simple documentation on the simplest thing.
I'm literally trying to run a little script to auto-format a document, partly based in content.
I want to grab the third line of document, or first 100 characters, I really don't care, and run the equivalent of String().indexOf('foobar') on it, to check if that part of the document contains a string.
I cannot for the life of me find how to:
a. Load text selection into a variable.
b. Run a sane semblance to indexOf.
Can someone please help? And maybe point me to a sane VBA documentation that is not Micrsoft?
a. Load text selection into a variable.
Identify a range (Word.Range) you want and get the Text property of that range.
For instance,
dim s as string
s = ThisDocument.Paragraphs(3).Range.Text
b. Run a sane semblance to indexOf.
Is InStr no good?
msgbox InStr(s, "foobar")

Programming syntax - searching an array for a string matching input - visual basic

Ok, I've combed the entire internet and can't find anything to help me here; I can't figure out the syntax for searching an array of stored words for a string matching an input string.
I understand the pseudocode of it, but I'm tripping up over what variables I need to put where, and how they should be formatted. If anyone here can help, it'd be greatly appreciated.
More than happy to provide more details should anyone request them.
Pseudocode;
Found = False
Loop through all the elements of the array
If current element = input,
Then found = True
End of loop
This is from the internet you've searched :
http://msdn.microsoft.com/en-us/library/eefw3xsy(v=vs.80).aspx
And this is for vb6 : http://www.vb6.us/tutorials/searching-arrays-visual-basic-6

VB.Net Events Practice Help

I was given an assignment to "write a program to print only even numbers between 6 and 16 using events", but I don't even know where to begin. The main thing I am having difficulty with understanding in this assignment is how I am supposed to specify that it only print even numbers in the given range of numbers.
Am I going to have to do a Mod2 code for each individual number and have it exclude any with the result of 1? Or is there another piece of code specifically designed for such an occassion? Perhaps there is some type of equation I can have the program read in terms of a variable, which holds the values of 6, 8, 10, 12, 14, and 16? I am just genuinely confused on how this is supposed to be programmed. Any assistance would be greatly appreciated.
No offense, but I'm not at all convinced that you are accurately relaying you assignment, but...
Firstly, using MOD is a good starting point, particularly as you are supposedly tying this in with events...
To use events as part of your solution, I would suggest creating a textbox withevents and a handler for textchanged, then in a loop set the txtbox.Text property to the string representation of the loop index (say going from 1 to 20), then inside the textchanded event turn the propery back into an integer, check to see if it's within the proper range and even(using, as you suggested, MOD).
The following will help you solving a part of the problem:
Dim number as Integer = 6
While number <= 16
// PRINT Goes here ..
number = number + 2
End While
These Microsoft links are good learning resources:
Learning Visual Basic from the Ground Up
Getting Started with Visual Basic
Video How to: Creating Your First Visual Basic Program
Events in Visual Basic
Closer Look: Understanding Properties, Methods, and Events
Events and Event Handlers