vb.net - Make specific randomly generated codes with timer -


i make randomly generated codes when timer finished.

but use code abcdefghijklomnopqrstuvwxyz0123456789

on format xxxx-xxxx-xxxx (replace x randomly generated number/letter)

and insert code in this

 private sub timer1_tick(sender object, e eventargs) handles timer1.tick     progressbar1.increment(3)     if progressbar1.value = 100         textbox1.text = "replace textbox code"         timer1.stop()     end if end sub 

here's solution using linq.

private sub timer1_tick(sender object, e eventargs) handles timer1.tick     progressbar1.increment(3)     if progressbar1.value = 100         dim chars = "abcdefghijklmnopqrstuvwxyz0123456789"         dim random = new random()         dim num1 = new string(enumerable.repeat(chars, 4).select(function(s) s(random.next(s.length))).toarray())         dim num2 = new string(enumerable.repeat(chars, 4).select(function(s) s(random.next(s.length))).toarray())         dim num3 = new string(enumerable.repeat(chars, 4).select(function(s) s(random.next(s.length))).toarray())         dim result = num1 & "-" & num2 & "-" & num3         textbox1.text = result         timer1.stop()     end if end sub 

Comments

Popular posts from this blog

Magento/PHP - Get phones on all members in a customer group -

php - .htaccess mod_rewrite for dynamic url which has domain names -

Website Login Issue developed in magento -