Get Combinations With Repetition?
May 26, 2011
How can I write all possible combinations to the console? For example, if user enters abc, then it will write aaa, aab, aac, abb, abc, acc, bbb, bbc, ccc.
Here's some code:
Dim abc() As String = {"a", "b", "c"} '
Sub Main()
Console.WriteLine("Enter the amount of characters")
[Code]....
View 3 Replies
ADVERTISEMENT
Jan 2, 2012
I have this code:
Dim combinations As New List(Of String)
Dim word As String = "abc"
For c1 = 0 To word.Length - 1
[code].....
View 2 Replies
Jun 2, 2011
the code for adding items in the combo box but without duplicates. i have an assignment which is a simple web browser. the combo box will be the address bar. and everytime i input an address, it will be added in combo box and should not repeat just like in the browsers
View 3 Replies
Jun 2, 2011
I have written an if...else statement which uses an array myArr and a string myStr as follows:
If myArr.Length > 0 AndAlso myArr(0) = "-1" Then
'Do stuff 1
ElseIf myStr= "xyz" Then
'Do stuff 2
ElseIf myArr.Length > 0 Then
[Code]...
It works exactly as I need. But It looks really confusing, mostly because the array length is checked twice. There must be a clearer way to write it, but I can't think of one. the order that each statement is executed is crucial. i.e. Stuff 1 has priority over stuff 2, which has priority over stuff 3.
View 6 Replies
Nov 20, 2009
Say you press and hold down a letter on your keyboard. The first letter gets added, there is a delay and then it repeats quickly on screen. Is it possible to skip this delay and go straight to the repeating part? I realize this might not be a visual basic question as much as a windows question, but if there is some way of toggleing it through my program, or using a workaround, i would like to hear the alternatives ^^ Setting the windows setting to fastest still has a small delay and others users would still experience it on other computers.
View 1 Replies
May 2, 2008
I have a button that when you click executes a certain code, lets say I make a menu that when clicked on should execute the same code, so how can I do this without having to copy/paste the same code twice.
View 10 Replies
Apr 1, 2008
Got a form linked to a database and i have the first column of data appearing in a list box on my form. In the database there are two records with the same value and so, of course, in my list box the value is given twice.How do i remove this repetition from the list box? (still keeping it the same in the database)
View 5 Replies
May 3, 2011
Here is the problem: In this question, you create an application that displays a multiplication table similar to the following figure, where x is a number entered by the user and y is the result of multiplying x by the numbers 1 through 9. Multiplication Table
[Code]....
View 2 Replies
May 11, 2012
I need to stop the execution of a program in VB.net. Within a repeating structure the program checks whether a variable is true or false. When the variable is false I need to stop the program execution. I do not want to close the program but simply stop it. One way I found was raising an exception, but I would not want to display the error message to the user. What is the best way to do it ?
Do
If myvariable=false then
throw new exception... 'Silent exception
end if
Loop until ....
View 3 Replies
Aug 27, 2011
i have a listbox which can be updated. and another listbox with some denominations concerning the first listbox. i am populating the listbox directly from the database. each item in the first listbox have many denominations given in the second listbox. the problem is when i add new items into the database, the items of the first listbox repeats. so in ma updated listbox, the items get repeated. how can i avoid this repetition.
[Code]...
View 2 Replies
Jan 20, 2009
The goal is simple... generate a set of random numbers with a certain range (e.g., 1-6, 5-10) with no repeats. I tried using a system with arrays where everytime a number has been generated, its marked as "used" and then the program is required to generate a new number. But it doesn't work!
Public randomnumgen As New System.Random
Public randomnum As Integer
Public iCounter As Integer
Public GotIt(7) As Boolean
[code]....
View 5 Replies
May 27, 2009
I have the following VB.Net 2.0 in an ASP.Net app:
output = Regex.Replace(output, "<p>(?:(?:<!--.*?-->)|&(?:nbsp|#0*160|x0*A0);|<brs*/?>|[su00A0]+)*</p>", String.Empty, RegexOptions.Compiled Or RegexOptions.CultureInvariant Or RegexOptions.IgnoreCase Or RegexOptions.Singleline)
Example stuff it matches well:
<p></p>
<p> </p>
<p><br/><br/></p>
<p><!-- comment --><!-- comment --></p>
[code]....
View 3 Replies
Apr 14, 2010
I'm getting a bit more fluent in VB.Net, but am still a bit green around the edges in certain aspects. I'm creating custom controls, and am starting to rely heavily on AddHandlers to manage them.Until recently, I didn't realize that you can add multiple event handlers for the same control and same address
[code]...
The above code would create 10,000 copies of the same event, and if I would click on combobutton1, the event would fire 10,000 times. I only need to fire the event once, but sometimes my code is a bit circular, and there may be an instance where two or more addhandlers are designated for a given control and address. Is there a way to have a loop on my custom dispose event where it would look something like:
[code]...
Or better yet, remove all events from a control(On a side note, is there any way in the debug mode to see all the active events attached to a control?)
View 2 Replies
Feb 25, 2009
how to validate 4 textboxes so that only numbers 1 to 4 can be entered but no number can be repeated.i already have code but it only validates some of the boxes and allows numbers to be repeated in other
Public Class frmGrid
Private Grid() As Short
Private Const intDimension As Short = 3
[Code]....
View 1 Replies
Aug 12, 2011
this website seems great and this is my first post. Sorry if this has already been answered but I have been searching for a long time. I have a program with a list view in details mode. I have it load column settings (visibility, display index, width, etc.) when the form is opened and save them when closed. There are many columns...about ten so far...like folder, file, size, etc. Is there a way to access variable names from the values of other variables?
[Code]...
View 3 Replies
May 24, 2010
What is missing is a way that when I give a print click on the quantity of copies informed skirt with sequential numbers without repetition
[Code]...
View 1 Replies
Oct 28, 2009
I want simply to generate rapidly combinations of 16 take by2 using linq.So I want to display me the combinations only not arrangements:1,2 (not 2,1 because there are combinations)...1,16 2,3 (not 3,2) because they are combinations..2,16..Comb of 16 take by 2 makes 120 so 120 combinations will be displayed on screen.[code]So my question is how to display rapidly on screen the combinations of 16 take by 2 using this Enumerable class of Visual Basic .NET(the 120combinations in fact)
View 9 Replies
Aug 16, 2011
I am facing problem while in detecting the multiple key combinations ..here is my cod
Private Function keyboardCallBack(ByVal nCode As Integer, ByVal wParam As Integer, ByVal lParam As IntPtr) As IntPtr
[code].....
View 1 Replies
Dec 28, 2010
I think what I'm trying to do is considered a permutation but I could be wrong. I've come across several examples of how to permutate a string as follows:
Permutations of {A B C}: {A B C}, {A C B}, {B A C}, {B C A}, {C A B}, {C B A}
What I'm needing are results similar to this (using the same input) with a repeat of each item to create a list of all possible combinations: {A A A}, {A A B}, {A A C}, {A B A}, {A B B}, {A B C}, {A C A}, {A C B}, {A C C}...and so on.
Below is some code that I found that almost gets me there with an exception of the repeated values:
'Generates all possible combinations from a series of words
Public Function PermutateString(ByVal input_string As List(Of String), Optional ByVal Base As String = "") As List(Of String)
Dim i As Long
[CODE]...
View 1 Replies
May 26, 2010
I'm trying to send Ctrl+A to Notepad but nothing is happening. Code for the button:
[Code]...
View 1 Replies
Sep 8, 2009
How can I bind a key combination to my vb.net application? I know it has SOMETHING to do with the registry, but I have no earthly idea what or how to go about doing this. I want the user to be able to hit those keys when the app is open and have it execute my function, but not while the app is closed.
View 3 Replies
May 30, 2009
I am trying to generate all possible 3 or 4 digit combinations from 0 to 9. I will be outputting them to a text file but I just need help with actually generating them.
View 7 Replies
Aug 3, 2009
I am writing an application in which we have a Product Module, Now instead of defining individual products, we want to just state the Size Ranges in Width, height and different size scale available, and then automatically generate a list of products with all the Size combinations. I cant figure how to do this.Ill give an example.This is how we define a product
Product[code].....
If i had a fixed number of Size types i would just run For loops within for loops and inside the inner most for loop write an Add Item statement with Index of evry selected item, however since the Size types are dynamic, i need to write a recursive loop, and i just cant figure how to.
View 7 Replies
Dec 11, 2010
My task is to develop a Control library (VB 2005) in which u enter a variable in textbox (>=1 , <=5). Lets say you enter "3" then u have too see in table all combinations of boolean numbers for 3bits (000, 001, 010 .....etc). If you enter "4" the table have to be different (0000,0001,....etc) with 16 combinations.
View 5 Replies
Aug 16, 2008
how you can register 2 hotkey combinations.(CTRL + END, and Alt + END).I'm using this code as a reference.
[code]....
View 12 Replies
Sep 9, 2009
I was wondering how to achieve a list with all possible combinations of letters. Now there are some nice examples on the Internet, however, I'd like to have the following:
Let's assume you have 3 letters (A, B, C), and have a limit length of 3, then it should display this list:
A
B
C
AA
[Code].....
Now, this would be fine with recursive calls I think, but I find it really difficult to think how to code that and how the computer will execute the code. It would be easier if all possibilities had a length of 3, but here that isn't the case.
View 30 Replies
Dec 10, 2011
Example :
If a got word "don" then file will contain
ddd
ddo
[code].....
View 1 Replies
Jun 11, 2011
I want to create an algorithm or formula that gives me the following combinations below. I have manually printed out all the combinations for the example containing 4 tables with respective values.
This is not permutation because i need the combinations to always follow the unique format [code]...
View 2 Replies
Jul 13, 2009
I would like a function generate all of the k-combinations of elements from a List of n elements. Note that I am looking for combinations, not permutations, and that we need a solution for varying k (i.e., hard-coding the loops is a no-no).
I am looking for a solution that is a) elegant, and b) can be coded in VB10/.Net 4.0.
This means a) solutions requiring LINQ are ok, b) those using the C# "yield" command are not.
The order of the combinations is not important (i.e., lexicographical, Gray-code, what-have-you) and elegance is favored over performance, if the two are in conflict.
(The OCaml and C# solutions here would be perfect, if they could be coded in VB10.)
View 5 Replies
Mar 25, 2011
how to generate combinations of pixels on a page using 24bit color using MS VB 10.0.
View 1 Replies