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

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

Related

How do I apply bullets to a table column in word using VBA?

I have applied bullets to a row without difficulty using
myDoc.Tables(1).Rows(3).Range.ListFormat.ApplyBulletDefault
but when I try something similar with
myDoc.Tables(1).Columns(4).Range.ListFormat.ApplyBulletDefault
I get the error method or data member not found with "Range" highlighted in vba.
I'm sure I'm missing something straightforward, but any suggestions would be great.
Okay, I've settled on two lines of code as follows in case this come up for anyone else:
myDoc.Tables(1).Columns(4).Select
myDoc.ActiveWindow.Selection.Range.ListFormat.ApplyBulletDefault

Getting Object Names of Dymo Label

Noob here just trying to speed up an annoying process at work.
I have many Dymo .label files and I'd like to get the names of the objects within it into an array. I've tried many things with Label.ObjectNames but as I say I'm only new to this and have no idea how to get this working in VBA.
This is as far as I've gotten, I'll eventually have this set up as a function for each label file:
Sub Main()
Dim Label As DYMO_Label_Framework.ILabel
Dim dymoFRAME As DYMO_Label_Framework.IFramework
Set dymoFRAME = New DYMO_Label_Framework.Framework
Set Label = dymoFRAME.OpenLabel("C:\Users\... ...\DetailedType4.label")
End Sub
If someone can show me an example and a brief explanation of how ObjectNames works I would be eternally grateful (I'm not one for stealing code without understanding it).
The labels have text fields in them, each is named by the property that needs to be inserted into that field. So I'd like to be able to extract into a normal dynamic array the names of each text field, "Project","PartNo","Description","Revision". I hope this helps –
Thanks in advance!
You can do :
Set LabelObject = Label.GetObjectNames(true)

How to make an ArrayList in C#

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.

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")