« first day (1871 days earlier)      last day (3077 days later) » 

6:00 AM
hi guys
 
 
2 hours later…
7:32 AM
Good mythical Monday
 
Guys anybody aware with form.prestine and form.dirty state
?
angular?
 
7:50 AM
No Angular knowledge, Sorry boro
 
hey guys, what do you use to integrate visual studio with git? git provider, console, or external app?
 
mysysgit command line
 
8:07 AM
I had 3 buttons on a form. I renamed a button. I had a procedure button1_click I tried to rename that procedure(probably a mistake to try that), then I got an error and now I can't see my form at all
I just get form designer code coming up
 
yea, you have to create the procedure again, or find in designer line that's responsible for adding an event to the button and comment it
 
I don't think me editing that code is a good idea
how do I recreate the procedure?
i can't even see my form
 
expand your form in solution explorer, 3 files there
or right click on form in solution explorer and "view code"
 
ah ok.. yeah I commented out the line in designer.. now the form has come up
 
does anyone know if its possible to combine a Textbox with a NumericUpDown (I want a numericUpDown control that displays like a textbox (Essentially a numericupdown without the Buttons on it, But When I made the buttons invisible/disabled. It still drew the Textbox as if the buttons existed) Should I make a numericUpDown class and Override the Drawing Code?
essentially I need a textbox that has the Max/Min variables and only accepts numbers.
 
8:13 AM
Jason winforms or wpf?
 
winforms
 
you can always create a regular textbox and validate it on valuechanged
check if number, and if it is in range
 
does the Valuechange get called before or after the gui is updated?
 
after, I think
 
so like if range is 1-9 and i put in 10, will it display 10 then run the validation...
 
8:15 AM
yea, and in validation you can just delete it, if it's incorrect
 
even if its only for a split second winforms isn't the best at non flashing so I would prefer to avoid that sort of validation
do you know of any other methods?
 
check out the events, you can add to textbox, maybe keypress would work in your situation
 
ok thanks
 
282
Q: How do I make a textbox that only accepts numbers?

MykroftI have a windows forms app with a textbox control that I want to only accept integer values. In the past I've done this kind of validation by overloading the KeyPress event and just removing characters which didn't fit the specification. I've looked at the MaskedTextBox control but I'd like a mor...

 
Anyone here know how to best draw vector graphics (or only polygons and circles) on a c# gui while allowing this to be zoomed in and out?
 
8:43 AM
Morning everyone
 
morning
 
hello
 
9:08 AM
Morning
bros
 
9:18 AM
I have a pictureBox inside of another frame that I would like to pain in, however if I use the onPaint() of the frame it will be overwritten, any idea how to bypass this?
 
With a solidcolorbrush @Thijser
 
How? I'm now trying to work by setting the base image of the picturebox as a bitmap.
 
9:34 AM
If you MDSN bitmap, you can also use solidcolorbrush for that
I've done it myself but haven't got that snipet of code on me at the moment
 
Alright thanks
 
9:46 AM
Hmmm... I have 2 dropdown lists.. 1 that adds data to the other on ValueChanged.. If I change value in the first drop down list 2 times in a row without changing in the second drop down inbetween, I get a System.Web.HttpRequestValidationException
But if I change in the second drop down list inbetween, I don't get that exception when changing in the first one
Request.Form-värdet som identifierats från klienten (DropDownList2="<Välj en användare>") kan vara skadligt.

Request.Form-value identifies from client xxxxxx can be harmful... or something like that
I can't seem to be able to debug before it crashes... Not on selectedindex_changed, nor page_load
 
That sounds like the error you get if you post back HTML
 
I figured it has something to do when I do dropdownlist.Clear() and then dropdownlist.items.add() in c#...
@Squiggle, I guess setting and remove drop down list items is included in that?
Alright, I just removed the dropdownlist2.add("<Välj en användare>") and it works fine apparently. I don't really need it anyway, but ye. Something when it does postback, it consider the dropdownlist.add harmful
------
Anyway.... Christmas hype
 
10:06 AM
 
Wtf
 
:)
@JakobMillah is it posting back the value "<Välj en användare>"?
because it will think that <blah> is a HTML tag, which it really doesn't like
 
10:22 AM
Ye it does, since I had to clear the second drop down list every time I change the first one
I see
 
10:45 AM
Lol
 
Gloria, in excelsis Deo!
 
howdy dudies
 
Howdy, boro!
Gloria, In A CHELSEA STA-A-A-BLE!
 
11:00 AM
kek
 
morning Mr. Zippy
 
The company that provides the REST API we use as our booking tool made breaking changes this morning
They didn't tell anyone and they don't use versioning.
"Where are they based?"
"Oh it's just a guy in China."
 
brillant
 
I hate for while loops
 
for while loops?
not do-while?
 
11:15 AM
maybe he meant for, while loops
 
for, while , do
was so much easier in vb
I'm stuck on why i if you know what I'm saying
I is replaceable with for example X , Dog, Cat right?
 
yea
 
Okay thanks :)
 
What about loops are you finding difficult?
 
int Maarten = 0
for (int maarten = 1; number <= 100; number ++){sum = sum + number;}
If I want a certain value, for example 22 to do something else then just add to the count
is that possible?
 
11:21 AM
That code is very confused.
 
Much like me then
 
yeah
If you want, maarten can start at 22.
You would usually just start it at 0 and change the <= value
 
I know that, but if I start at 1, and want to do somethin g when it reaches 22
Without breaking the loop
so for example
1-21 he just does +
at 22 he does sum(1-21) - 22
 
ugh
fucked it.
 
Sorry :(
 
11:24 AM
yeah just do if maarten < 22 { bla } else { this }
Nah I edited my message and ran out of time
lol
 
just add an if inside?
 
so after that if statement it just continues the sum?
 
if (maarten == 22)
 
I'm confused about what you're trying to achieve.
 
int sum = 0; for (int maarten = 1; maarten <= 100; (if maarten == 22){TextBox.Show("Like this?") }maarten++)
{
sum += maarten;
}
 
11:26 AM
btw, @MaartenWachters Your for loop is... weird?
 
herp
don't do that.
 
omg
 
But will it work though?
 
You can do stuff like that but it's not very readable.
 
for (int i = ; i < 100; i++)
{
if(i == 22){}
}
 
11:28 AM
So I put that stuff inside my loop. Makes way more sense
I think my train of thought was a bit derailed to say the least
 
Yep
for loop is among the greatest really.. Love them
 
Java sucks
4
I've been advised to do more complex logical stuff like that in Java before
 
Jakob
To expand on that
 
You might save some time doing so... But it's just wrong... In my opinion
 
If I want to do a math pow on EVERY single addition in my for while loop
Do i do like Math.Pow(sum, 2) then?
 
11:31 AM
with addition you mean the increment part?
for ( init; condition; increment ) {
statement(s);
}
 
i++)
thats an increment right?
 
yes
 
Then yes
 
That is perfectly fine
 
Okay
Having a bit of trouble understanding these loops but getting there now
 
11:32 AM
Takes a while, but they are your tool and will be forever so... You get used to them quickly :P
 
HMm
they're like if but a bit harder if you know what I mean
I made a program that had like if { if { if { x 20 or so
this will make it way easier
 
Yep pretty much
You will eventually end up with:

for()
{
for(){}
}

But it is pretty bad and you will most likely learn why
 
At least not goto
 
With goto you mean switch cases?
 
Cases I fucking hate
I'd rather use If's then cases
 
11:35 AM
Cases are lovely
 
I, like every other human, hate everything that I am bad at.
 
They are really good in some situations
 
goto is loop mechanism too
just like in pascal
 
cases are a lot more readable than ifs
 
Used them hell lot in hardware programming
 
11:37 AM
but it's limited to String and int, isn't it?
 
Controlling robots for instance.. 1 state for different movement for instance
 
to primitive types, I guess
 
private void button_Click(object sender, RoutedEventArgs e)
        {
            double macht;

            for (int i = 1; i <= 10; i++)
            {
                 macht = (Math.Pow(i, 2));
            }
            MessageBox.Show(Convert.ToString(macht));
        }
The messagebox is giving me an error at "macht"
 
what sort of error?
 
string.Format("{0:N2}%", macht) - try using that
 
11:40 AM
that code will only return math.pow(10,2) as well
 
^
 
Found it
 
if you want to add them:

macht += (Math.Pow(i, 2));
 
ehm, actually, it doesn't return anything
 
I neded to put it inside my loop
 
11:41 AM
void
 
true :P
 
but I know what you meant
 
@TomW you're technically correct, which is the best kind of correct!
 
ye.. Return was the wrong word
 
and i thought it was problem with rounding:P
 
11:41 AM
set* is probably right
 
@JakobMillah Nope it returns everything
 
So back to the error:
 
I fixed it
 
did you get it working?
goodie
 
To say it in shitty english. The macht was only saved inside the for loop, so if I used to macht outside it said uhu non existant.
To fix it I put the messagebox inside the loop
 
11:43 AM
Well, macht existed but was probably null?
 
I'm guessing you guys are right. They're not <i>That</i> hard
 
@JakobMillah it's a value type. It can't be null.
 
Hmm yeah
It said about local variable unassigned
 
@TomW So when he defines macht as double, does it get value "0"?
 
You need to initialize macth if you try to output it outside the loop
 
11:44 AM
I did that
But it still throws the same error
 
@JakobMillah it should. And that's what happens. But the compiler 'helps' by imposing an error that isn't fundamental to the language
 
I see, coolio!
I don't think you get that help in C or C++ if I am not mistaken
 
I think so too
 
private void button_Click(object sender, RoutedEventArgs e)
        {
            double macht;

            for (int i = 1; i <= 10; i++)
            {
                 macht = (Math.Pow(i, 2));
                MessageBox.Show(Convert.ToString(macht));
            }

        }

private void button_Click(object sender, RoutedEventArgs e)
        {
            double macht;

            for (int i = 1; i <= 10; i++)
            {
                 macht = (Math.Pow(i, 2));

            }
            MessageBox.Show(Convert.ToString(macht));
Sorry for wall of text. But try those 2 out
 
if it was a class member for example it'd happily get passed around as 0
 
11:46 AM
Even though I have initialised macht as a double on toplevel, it still won't take it outside the for while loop @AngryDumbassSlapper
 
a little off-topic.
I would probably write:
macht.ToString() instead of Convert.ToString... :) Just to minimize the code a little
 
Noted :)
 
So in the second method, what is macht equal after the for loop?
 
Unassigned
 
To weigh in on switch vs if
 
11:50 AM
Fancy
 
Start using switch and you'll grasp it quickly
You should also grasp when it isn't appropriate
 
Another question though
 
Our codebase is plagued with inappropriate switches lol
 
I've already made a random number generator , but if I want it to generate 6 numbers using a for while loop
Actually I do have an idea brb
 
You made one?
846
A: How do I generate a random int number in C#?

GuffaThe Random class is used to create random numbers. (Pseudo-random that is of course.). Example: Random rnd = new Random(); int month = rnd.Next(1, 13); // creates a number between 1 and 12 int dice = rnd.Next(1, 7); // creates a number between 1 and 6 int card = rnd.Next(52); // creates a...

 
11:52 AM
Already got that
I did that weeks ago for a dice 'game' I made
 
Create a list or array :)
 
You can't just generate random numbers via traditional loop, you need assist from reserved class
 
I made a 'game of goose'
 
^
 
I'll try this out and i'll post it here
Because my english isn't the greatest
 
11:53 AM
System.Random is as close to actual randomness as you're gonna get really.
 
But what was the problem? To put the 6 random numbers in a container?
 
One of my colleagues had to write a Mersenne Twister himself because System.Random apparently wasn't random enough
 
Lol rip
Who decided that
 
haha
 
I was like...you haven't actually proved that was the problem, have you
significantly more likely to be to do with floating point arithmetic
 
11:55 AM
kek
If he actually wanted to make one then fair on him
I wish I had the energy to maths.
 
I miss maths
 
I done goofed
 
sup
 
You can just put last 6 digits from your phone numbers, as they are completely random, random is a relative thing :D
 
11:56 AM
Gonna be pretty static random numbers
 
They were once generated at random, sure.
 
Sippy Conversation generator:
while(true){
switch(rand.Next(0,2)){
case 0 : "kek";
case 1: "rip";
case 2: "kappa"; }
}
2
 
private void button_Click(object sender, RoutedEventArgs e)
{
Random test = new Random();

for (int i = 1; i <= 6; i++)

int getal = test.Next(1, 101);
MessageBox.Show(Convert.ToString(getal));

}

^ This throws an error on the int getal line
@TomW Dank memes bro
 
@TomW I have more
wutface
 
FailFish
KappaPride
KappaRoss
 
11:58 AM
KappaRoss
 
Lol
 
2fast4u
 
People have been spamming twitch emotes in the Albion global chat for the last week.
 
11:58 AM
you can't initialize int getal every time
int getal; before the loop
then getal = test.Next....
 
"I sexually identify as an attack helicopter" has come up quite a lot
 
Taking this back. doesn't work Kappa
 
@MaartenWachters Please don't... The guys around here are 10x more clever than me
hahahaha
 
Huy guys? I wrote unit test to testing method of the AccountController entity. AccountController has
private readonly string _adminRole = Resources.AuthorizationRoles.Admin;
but when i trying
var sut = this._kernel.Get<AccountController>();
in test method -> debuging stops without an exception. Why it works so?
 
doing;

int x; inside a for loop is bad practice anyway. Since it will fill the stack
 

« first day (1871 days earlier)      last day (3077 days later) »