I've been out of doing proper programming for sometime, so as an exercise in trying to get some practice, I'm trying to make a program to solve Sudoku in C# (VS 2010)
My problem occurs when I'm trying to create some form of initial grid for the data out of text boxes. Back when I used to use VB6, I could call all text boxes as a single name and then give them all an index number which would allow me to refer to a specific text box when I was in a loop.
As far as I can see, there's no easily visible equivalent in C# and my searching has been to no avail although I can't imagine it'd be a feature that would be removed.
Thanks in advance
You can create a control array.
http://www.devasp.net/net/articles/display/674.html
It would probably be easier, and look better, if you use a genuine grid control like the DataGridView.
One bit of bad news. In the days of VB4,5,6 Microsoft used to release a new grid control with every version of Visual Basic, which was annoying (unless you rewrote your code every year). Well, they are still at it.
Related
In my project I have the need to create a Form with 16 identical replicas of the same controls. So far I've managed to do this by just copying and pasting the controls and renaming them one by one, however this is becoming really inefficient and I feel like there must be a better method to handle this situation.
Down below there is an example of what I'm talking about: every line has the same controls that are handled exactly the same, have the same Items and only interact with each other within the same line.
Is there a way to create a modular group of controls that I can replicate and handle with a simple incremental index? The best would be if modifiying the original one would affect every copy of it!
I'm using Visual Studio Express 2013 for Windows Desktop and C# as programming language.
This kind of data calls for a DataGridView Control. It supports text, checkbox and combobox "out of the box", and you can add support for Numeric Up/Down Cell as described here: https://msdn.microsoft.com/en-us/library/aa730881%28v=vs.80%29.aspx
Creating a custom control as Johnny Mopp suggested (in the comments) was the best solution for my problem.
I am working with C# in Visual Studio Community 2013. I have been trying to display data in a DataGrid that I have set up in a Window in my application. I've been finding various web pages including 1 or 2 from stackoverflow that are supposed to show ways of inserting and displaying the data, but every time I try one of these approaches, it doesn’t work for me.
Most of the time it seems like the code in these pages is from a previous or different version of Visual Studio and it just won’t work with Visual Studio Community 2013. I say that because I keep getting error messages in VS 2013 telling me the code isn’t correct in one way or another. This is when I’ve copied what’s in the corresponding web page exactly. Also, I’ve usually spent time looking into the errors without finding a way of resolving them.
I just want to be able to insert data into the DataGrid so that I can see it when I look at the app.
Please can someone show me how this needs to be done, or point me in the direction of a website/page that will show me how to get this working? This is obviously in Visual Studio Community 2013. I realise that I need to use data binding, but so far I haven’t found a way of doing that that actually works in my code.
I could paste the code I have so far up here, but there’s a lot of it and it would take up a lot of space. I will therefore hold off from doing that until someone actually asks for it.
At this stage I have the database data set up in class instances, which store the data that I want to display. The data is all just bits of text or numeric values. The instances are stored in a class that’s like a CollectionBase List, so that I can get individual instances from the list as I need them. My aim is to be able to display all of the instances, or just some of the instances from the list, dependent on how the user interacts with the application. However, at this stage I just want to be able to display something, and so far that hasn’t been possible.
I also have the DataGrid set up with all the required headers for the various columns, plus various settings that I found were needed from looking on line. These can obviously be changed as and when I get some guidance on how to sort this out.
I'm programming in C# with Windows Visual C# 2010 Express.
My goal is to create a form that shows a single row of Textbox inputs at initialization, but after the information has been filled out, have the program create a second row to allow for the user to enter another row of information. I also don't know the limit to how many of these rows will be needed, hence the hope to dynamically create them. I want this program to be versatile enough to create an infinite (sort of) number of TextBoxes/Buttons/Labels/etc.
Everything that I've seen so far is web-based (C# in ASP.Net). I want to make a program that has this functionality instead. Any thoughts or insights? I don't know if this is possible.
Use a DataGridView with a TextBoxColumn and use a BindingSource to attach it to a List<string>.
Ok, so long story short, I was working on a .NET WEBFORMS project which was capable of creating ASPX pages through an ASPX form, which was basically a drag and drop controls page which, we could say, seemed to be a basic but functionality acceptable page/wizard/aspx-creator.
Well, now my higher-ups decided that approach is not a worthy solution and, I don't know why, they got into their heads that this, instead of this ASPX creator form, could be implemented through custom controls added to the toolbox.
So, my doubt is... is that even possible? Or better, is that a reasonable solution? I mean, the first cons I've already found is the fact It seems that it's impossible to yield CodeBehind code by the drag and drop method.
Thanks in advance!
Custom Controls
This MDSN walkthrough teaches you aboutmaking custom web controlls for asp. these would be able to appear in your tool box and could be dragged into its respective place, is this waht you are looking for?
EDIT:
Re-reading it looks like you want to be able to drag in bits of code and have certain regions prompted for edits, this CAN be done, using snippets. if you type propg or propfull and tab twice it constructs that code and tells you what bits to edit right? you can make your own snippets!
Creating custom snippets
failful msdn tutorials to the rescue once more!
Just wondering whether anybody has tried to hack into WPF DocumentViewer in order to make it more useful. I've spent almost a week already trying to create more powerful API for this control based on it's methods which I extract using reflection.
Everybody knows how to get selected text from document viewer via reflection but my task is more complicated. Selected text has End and Start properties which return ITextPointers. Also I have a collection of GlyphRuns extracted using this code. And now finally I want to find out which GlyphRun contains selection start.
So I want to know how to convert ITextPointers into GlyphRuns and vice versa. I understand that they do not have 1:1 relationship. This control with closed API and last week spent in Reflector doesn't let me sleep well. I hope maybe somebody tried to do it before or seen code samples and will be able to guide me through these jungles.
I would recommend that you abandon this approach. Doing lots of private reflection like this is not something you should be basing production code on, its very brittle and downright forbidden in some contexts. Frankly, you're better off finding a 3rd party control that suits your needs such as www.infragistics.com
Or if that's not an option you can probably create your own control in the amount of time you'll have to sink into getting this to work.