Hack Forums
[C#] c# / Combining one keyword with password list - Printable Version

+- Hack Forums (https://hackforums.net)
+-- Forum: Tech (https://hackforums.net/forumdisplay.php?fid=444)
+--- Forum: Coding (https://hackforums.net/forumdisplay.php?fid=151)
+---- Forum: Software Development (https://hackforums.net/forumdisplay.php?fid=118)
+---- Thread: [C#] c# / Combining one keyword with password list (/showthread.php?tid=4843207)



c# / Combining one keyword with password list - Zenode - May 30, 2015

I want it to do this

First listbox (or textbox): red
Second listbox (no textbox): 1234
minecraft
batman
password123

then the outcome

red:1234
red:minecraft
red:batman
red:password123

I figured out to combine two listboxes that have the same amount of items in item in it, but I need it to be able to combine 1 into several like above. Thanks.


* - SIM-2193483 - May 30, 2015

AIOHNB have this feature, just use that.


* - Zenode - May 30, 2015

(May 30, 2015 01:19 PM)VLuF Wrote:  AIOHNB have this feature, just use that.

well yes I know that, I'm wanting to code myself one to teach myself c#


* - SIM-2193483 - May 30, 2015

Oh just realized that this is in the C# section, cant help you with that I think sorry


* - Only3 - May 30, 2015

just check if the other listbox item is not nothing and combine


* - Odus - May 30, 2015

I've dealt with this exact question before. Give me a minute so I can find my answer.

Edit- found it:
Code
listBox1.Items.AddRange(input.SelectMany(u => input, (u, p) => string.Join(':', u, p)).ToArray())

Assuming input is a collection.


* - tojba - May 30, 2015

Something like this?

Code
foreach(string s in listBox1.Items)
{
    listBox2.Items.Add(textBox1.Text + ":" + s);
}



* - Zenode - May 30, 2015

Thanks guys for the help i got it working ^.^