|
I'm having a small logic problem, maybe you guys can help?quote:string scores = ""; But when I display the string, it only shows the last index of the list. e; disregard this, I figured it out. scores += score[y] + "\r"; duh.. so stupid of me. Sab669 fucked around with this message at 01:28 on Dec 10, 2009 |
# ¿ Dec 10, 2009 01:08 |
|
|
# ¿ Apr 28, 2024 03:52 |
|
I'm having a bit of a problem with a combo box for this project I'm working on. Basically, the program is just a simple application that let's the owner of a restaurant manage employee data, items on their menu, and reservations. I'm handling the menu portion, and my two group mates are doing the other two functions. Each one of these three functions will obviously have the basic Create / Read / Update / Delete abilities, and I have 3 out of 4 of these functions working. I'm stuck on the Update portion. So, say you launch the program, this is what it'd look like: Then when you select Menu, you're presented with the various CRUD options: As said, I'm stuck on Edit. I have the user prompted with a combo box that lets them select the piece of food they want to edit, then click the button: That will open up a new form, which is populated with info from the database HOWEVER the combo box is what I'm stuck on. I've tried changing all sorts of properties, but I have no idea which one I want to change, and it keeps throwing errors that I don't quite understand, or it doesn't throw an error and then defaults to the first thing, which is Appetizer: What it should be: So yea, I've tried tooling around with drat near every property of the combo box, and I can't seem to figure out what I'm doing wrong. Here's the code for the entire page. Initially, instead of a for loop, I just had while(drSelect.Read()) but that was returning -1 for menuType, I think? So I tried a for instead, but that didn't solve the problem. http://pastebin.com/CZVWBYn8 The database I'm using has 2 tables. Menus, which stores the menuID, menuPrice, menuName, menuDesc, and menuType (foriegn key to the following table) Types, which stores typeID, typeName So this would be the Appetizer, Entree, Dessert, Beverage table. But again, I can't seem to get the Edit Menu form to properly display which course the designated food falls under. Any ideas what I'm doing wrong, goons? Sab669 fucked around with this message at 00:13 on May 5, 2010 |
# ¿ May 5, 2010 00:07 |
|
Sweeper posted:I'm couldn't really follow your post, but you want it to have Entree selected? Well, for the condition shown in the screen shot, yes, Entree is supposed to be selected. But if they chose Bud Lite in the previous prompt, then it should display Beverage. I've tried cmbCourse.SelectedIndex = Convert.ToInt16(drSelect["menuType"]); and it didn't work. As I've said, I've tried drat near every property for the combo box. From SelectedMember, Index, Value, to DisplayMember or Value, I've fidgetted with almost everything.
|
# ¿ May 5, 2010 00:30 |
|
Sprawl posted:Well you are setting the index an int value with a 0 index to well i'm not sure how that even works. I've made the mistake of going to a Tech school, rather than a traditional college, so this is actually my "senior" project. Will have my associates degree in a few weeks. e; so yes, I know it's terrible and I'm not a good programmer.
|
# ¿ May 5, 2010 00:32 |
|
I've tried printing out menuType to a text field, like just concatenating it onto txtDesc.Text and it does return the value expected (in this case, a 2).
|
# ¿ May 5, 2010 01:29 |
|
Sprawl posted:Okay well iirc a combo box index is a 0 index so you would need to -1 to that value anyways. Well, the thing with ID - 1 is that ID is actually the ID of the meal they edited, so that can range from 1 through 40 based off whatever meal they selected from that first drop down box. But I get what you're saying. I could just parse out menuType to any variable, subtract one, and then do SelectedIndex = that. Thing is though, I know I tried setting SelectedIndex = menuType, and it threw some error. I don't recall what, exactly though. And I'm honestly not sure if I can work on it now (I'm out of class finally) and my laptop was having some problems connecting to the DB last I knew.
|
# ¿ May 5, 2010 04:05 |
|
Sweeper posted:You should have a meal type id and a meal id, otherwise you can't tell what kind of meal it is without hardcoding it in. The meal type id will tell you if it is an entree or whatever and the meal id is the unique id you identify the meal as. In the menu table, menuType is just an int from 1-4, which is a foriegn key for the actual Types table, which is typesID (this being the other key), and then actual typesName field. Thanks for the help guys. I'll try it out when I get a chance. I guess one last big question; how bad IS my code?
|
# ¿ May 5, 2010 13:15 |
|
I have now found I have an excessive amount of spare time on my hands- forced into switching to part time for school, hours getting cut at work, distance relationship with the girlfriend. So I have copious amounts of time, and I want to try and do something constructive. I have my associate's in IT / Software, but I really don't know gently caress all. I was hardly even taught how to work with classes. Either way, I want to brush up on my C# so I can actually do stuff, but I have no idea where to start. I can't come up with a program I'd like to make, anyone have any tips on how to motivate myself? Any websites out there that have 'homework assignments' so I can try and do something? Learning how to do stuff with graphics would be awesome, but I guess one step at a time.
|
# ¿ Dec 18, 2010 03:24 |
|
I'd like to think I'm a competent IT major. I graduate soon and I've started to look for work. My roommate works for a company and I just found out they have a few openings for a Embedded Firmware Engineering position. My only problem is it's straight up C. I've done SOME C++, but all of my formal education is in C#. How difficult would it be to learn C?
|
# ¿ Jan 17, 2012 04:39 |
|
Interesting insight, it is for an entry level thing (it says 0-2 years exp. in a professional environment). I think I'm still going to apply for it? Either I get interview experience, or I get a job and who knows from there. It is definitely something I'm interested in, I think it'd be really cool to work that low-level and have that level of control. e; vvv What? Sab669 fucked around with this message at 18:08 on Jan 17, 2012 |
# ¿ Jan 17, 2012 18:00 |
|
Good god, why is VB so ugly? I found what could be an awesome job, except its "70% VB, 30% C#" so I've been looking at VB today.. god drat
|
# ¿ Jan 25, 2012 22:41 |
|
Shy posted:Why? I never used it but I thought it pretty much does the same job as C# almost as easily. Well, I mean it's similar enough, it just overall seems like a lot of extra typing compared to what I'm used to http://www.harding.edu/fmccown/vbnet_csharp_comparison.html That's what I was briefly skimming for a comparison
|
# ¿ Jan 26, 2012 00:46 |
|
So, I'm pretty new to the whole "security", thing. I don't take my first official software security class until next quarter, but I'm always down for learning sooner. I'm working on an online shopping cart sort of application in a .net class I'm taking this quarter, and I have it so people need to sign up before they can purchase stuff. But I'm curious, what's considered the 'proper' way of encrypting passwords in .Net? I recently "learned how" in PHP (or rather, someone briefly showed me the phpass class), but I wouldn't know how to properly encrypt it when I first add a user to a database, and then when they actually log in compare that to what's in the DB. Any pointers, goons?
|
# ¿ Feb 1, 2012 19:10 |
|
In regards to my post the on the previous page, I guess I didn't realize there was a difference between "encrypting" and "hashing"- thought they basically meant the same thing. But yea, I know I never want to store the users' passwords. Have them create an account, hash and salt the password (account creation date/ time is a common salt from what I hear),and then re-do the process when they log in... but I don't know how to actually do that in the language is what my issue was. I wasn't sure which has is more secure than another or how to actually handle any of it. Thanks for the crash course, though. e; Found this on StackOverflow code:
Sab669 fucked around with this message at 16:43 on Feb 2, 2012 |
# ¿ Feb 2, 2012 16:36 |
|
I guess I must be doing this completely the wrong way. I'm trying to make a shopping cart for class and I've got most of the framework set up [I think] and now I'm trying to do the front end. This is probably going make a lot of people cry, but I guess I don't know how else to do it. http://pastebin.com/XTVtN4MM Basically, I'm just looping through my SqlDataReader object to print out a table that has a thumbnail of each item. I have a label that doesn't show up on that stores the product ID. But the button doesn't show up, either. I am aware the button doesn't have any method tied to it yet, I was going to do that after I got it to all appear properly. But yea, uh, after you guys recover from your head exploding could someone tell how I should be making the button to add stuff to the cart display? e; Oh, and then tableCode is just being thrown into a label on the page. Everything shows up fine except the button / the label that stores the productID (I don't want that label to show up, though) Sab669 fucked around with this message at 22:42 on Feb 13, 2012 |
# ¿ Feb 13, 2012 22:37 |
|
Oh, that's pretty cool Ithaqua. I wasn't aware that that was even a thing. I was kind of thinking about how I'd do this in PHP an adapting it to this project. Though I suppose even in PHP that's not exactly the best way to do it.
|
# ¿ Feb 14, 2012 00:06 |
|
edit; one big giant derp
Sab669 fucked around with this message at 22:41 on Feb 16, 2012 |
# ¿ Feb 16, 2012 22:37 |
|
What would be the difference between a DataList control and the Repeater control? Unfortunately, the Murach ASP book simply states, "Instead of a DataList control, you can also use the Repeater control, which has one draw back. It cannot be designed through the interface, and as such it won't be discussed in this book". A few weeks ago I mentioned I'm working on a shopping cart for a website and was approaching displaying the results of a SQL statement completely wrong and I was told to look into Repeaters. Having a bit of trouble understanding a lot of the tutorials I'm finding online, though.
|
# ¿ Mar 1, 2012 22:31 |
|
A few more newbie questions I'm trying to loop through a folder and display all of the images in it. Then, I'd like each image to be clickable so that when it is clicked it'll automatically download the file. code:
Also I'm having issues with that line I commented out as well. It gives the error, "No overload for imageDownload matches delegate System.Web.UI.ImageClickEventHandler" but the first issue of them not showing up is a bit more critical at the moment.
|
# ¿ Mar 6, 2012 21:58 |
|
Looking through a breakpoint, it says buttons[0]'s ImageUrl = "E:\\MyProject\\Images\\Image1.jpg", so that would be correct, right? e; or should it simply just be Images\\Image1.jpg?
|
# ¿ Mar 6, 2012 22:07 |
|
Yea, that was dumb of me Ithaqua. I'm not sure why I thought it'd work I was able to just Subtract 0 - n so that it was only putting in Images\\Image1.jpg into the ImageUrl, then added that to a control on the page and it worked now. Now to iron out this issue of not being able to set the OnClick in the code...
|
# ¿ Mar 6, 2012 22:31 |
|
This is a really dumb question but I've never had this happen before. I just got to class to finish up a project. Set some breakpoints before/where it crashes and hit F5, but no window pops up showing me whats in all my variables and stuff. I've no idea what this window is even called to look for it, and my teacher isn't sure either. He thought it was the Immediate window but that's not it. Anyone know?
|
# ¿ Mar 12, 2012 19:37 |
|
I'll try that. I was also able to just google "Visual Studios Debug window" and found a screenshot of what I was looking for, the "Local" window. So I just typed in Local into the Command window and that pulled it up for me.
|
# ¿ Mar 12, 2012 19:42 |
|
Are any of you goons familiar with the StrataFrame framework? I'm contemplating applying for an internship with a company that uses it. The website for it looks very... "tries to be cool" and turns me off, I feel. I've never heard of it before, but hey I'm also a student so what do I know.
|
# ¿ Mar 22, 2012 16:12 |
|
edit; fixed.
Sab669 fucked around with this message at 20:12 on Apr 26, 2012 |
# ¿ Apr 26, 2012 20:09 |
|
This is a random, dumb question, but is there a way to set the width of a combo box's menu? The actual part that displays the currently selected index is small to fit 'in line' with the rest of the controls on this form, but then when you expand it to select the item you want you can't read all of the text. e; of course as I post I re-read the property list for a third time and find the DropDownWidth
|
# ¿ May 4, 2012 16:20 |
|
Any of you guys have experience using the Property Grid control? For example, lets saying I'm making a tool to generate a weapon. I've got a List View on the side of my form that lists all the possible components; barrel, stock, scope etc. I would like it that when I click on one of the barrel, the property grid would show options A, B, and C to set. stock will show X, Y and Z, and scope will show another set. Problem is, I have no idea how to use the PropertyGrid. Does anyone have any decent recommended readings or sample projects? I see it has a Selected Object property, which I can set to a row in my list view, but that lets me edit the row itself- not the item in the row. Sab669 fucked around with this message at 21:08 on May 9, 2012 |
# ¿ May 9, 2012 20:41 |
|
Alright, playing around with that property grid from last week a little bit more and I'm having an error with that / list view control...code:
Now, the funny thing is when I launch the application and select an item the first time it works as I expect it to. But then when I select a different item, it crashes and gives me this error: System.ArgumentOutOfRangeException was unhandled Message=InvalidArgument=Value of '0' is not valid for 'index'. Parameter name: index Whether I run it and select the second item in the list, then the first or run it and select the first then the second it gives me this error on the first line of that event. Edit; Well, no idea what the hell my problem was but it's fixed Sab669 fucked around with this message at 20:50 on May 14, 2012 |
# ¿ May 14, 2012 20:03 |
|
So I've been posting my frustrations about the Property Grid control lately, and I've overcome most of the issues I've had except I'm having quite a bit of trouble understanding this. The user launches the application, selects a job order and then a list view is populated with a "component" object. The user selects one of these components, and then another class is populated based on the various properties/configurations this component could have. I've been using this to loop through a result set and add the appropriate component properties to the object. However, with the method I'm using, every property of that PropertyBag class is just a string, but I'd like to be able to handle images or combo boxes in the property grid as well. I can't seem to figure out how to determine that though, I was thinking of perhaps adding a column to the database for each property that would just list how it should be handled in the property grid, then when that property bag is being built it would take that into consideration. Any advice on a possibly simpler way to handle something like this? e; Also, random question. What's the difference from simply trying to cast something from one data type to another, and using the Convert class' various ToWHatever methods? Sab669 fucked around with this message at 19:18 on May 21, 2012 |
# ¿ May 21, 2012 18:43 |
|
This is kind of a random question, but is there a way to move where a form is displayed in Visual Studios in the designer? Like this;
|
# ¿ May 25, 2012 13:57 |
|
epswing posted:Why? Well, I got a new job recently and my monitor space is... significantly larger than what I'm used to. I can't seem to get a comfortable setting to work in when I'm looking at the designer. I know it sounds kind of retarded and babyish, I wasn't sure if it was some easy thing to do that I just never learned / couldn't find on Google.
|
# ¿ May 25, 2012 19:48 |
|
In C#, I have a form1 that can display form2. When form2 closes, how would I refresh a control on form1?
|
# ¿ May 30, 2012 14:38 |
|
Mr.Hotkeys posted:Add something like the second line before you show the form: Thanks for the tip; what exactly is happening here with the ((s, e) so I can go read up on it? e; vvv Very interesting. Sab669 fucked around with this message at 15:05 on May 30, 2012 |
# ¿ May 30, 2012 14:58 |
|
So I'm trying to create a little logging system that keeps track of changes to a business object.code:
Am I wrong in my logic here? Does Object.Equals work differently? When I make a change to a field for the object, the if statement is being skipped over.
|
# ¿ Jun 1, 2012 15:23 |
|
How would one go about populating an array with the values from a combo box?code:
Sab669 fucked around with this message at 19:47 on Jun 4, 2012 |
# ¿ Jun 4, 2012 19:40 |
|
Unfortunately, if I try that, each item in the array just says System.Data.DataRowView. Might just try to go about this in a different way entirely.
|
# ¿ Jun 4, 2012 19:54 |
|
Ithaqua posted:That's because you're putting a DataRowView in your combo box. You should be able to access it by the property name: Ah, the thing with that is when it comes to production time, the end user will actually be able to add values to what could appear in this drop down if they so chose, so I was hoping to just automatically go and get everything in it and throw that into the array for use elsewhere. But I approached the problem differently and it does what I need it to do now, though. Thanks for the help as always goons.
|
# ¿ Jun 4, 2012 20:31 |
|
Well, for what it's worthMSDN posted:@Disconnect So it sounds all rather redundant (if you don't need any of the 'extra features'), but what the hell do I know. Personally I'd say, what's 2 extra method calls and just do it.
|
# ¿ Jun 4, 2012 22:30 |
|
More property grid questions! Just when I thought I was out, THEY PULL ME BACK IN. Is there a way to disable this stupid thing from showing up at run-time? It really doesn't bother me, but my boss wants it gone and I don't see anything relevant to "Property Pages" in the PropertyGrid's property sheet in visual studios, and can't find much on Google. Also, I see the PropertyGrid has a "PropertySort", which can be set to NoSort in which case it displays records in the order in which they are received. I was hoping to maintain a categorized grouping of properties, but have the category and the property itself have an ID that would determine their appearance. Is that not possible? As soon as I click the "Categorized" view mode during run time, it goes to Alphabetized Categories. Sab669 fucked around with this message at 22:10 on Jun 6, 2012 |
# ¿ Jun 6, 2012 21:30 |
|
|
# ¿ Apr 28, 2024 03:52 |
|
Does the SelectedIndexChanged event on a ListView not get fired if you programmatically set the SelectedItem to a value that is the same as what is currently selected?
|
# ¿ Jun 11, 2012 20:39 |