|
Nothing you provided looks obviously wrong. Which statement throws the Exception? We may need to see the query.
And provide the code in proper order.
modified 3-Dec-14 14:47pm.
|
|
|
|
|
did you debug to identify on which line you had the issue?
Mark the answer as accepted if that worked for you .
And for down-voters please specify the reason to improve the solution .
|
|
|
|
|
HI...
I am beginner in WPF and I have a problem with saving data from DataGrid to text file (text file is usedby other program). I check on google, bing and find nothing. Please help.
|
|
|
|
|
I'd suggest you post your code and show where you are stuck.
There are only 10 types of people in the world, those who understand binary and those who don't.
|
|
|
|
|
Member 10024517 wrote: I have a problem You need to explain clearly what that problem is if you want assistance.
|
|
|
|
|
I will paste my code later, but what I want is to save (export) data from data grid to text file. For example we have few columns number|data|description|date|img with few rows. Then I want to save that to text file in format
number///data///description///date//img (one row for one line in text file).
|
|
|
|
|
Could you recommend me a method how to create a hotel room booking calendar like this?
http://www.daypilot.org/tutorial/hotel/[^]
I have two ideas and I tried to create the calendar, but I have problems with it.
1. idea: Create a DataGridView. It is good because there are cells and header cells in it, it is scrollable, but I can't insert controls in the cells (button or panel) which would show the reservations through days (like in the example) because column span is not supported by the datagridview.
2. idea: Use a TableLayoutPanel. It supports column spanning and I can insert any type of Control in its cells, so I can insert controls which shows the interval, name, etc.. of the room reservation and it can overlap many cells. The only problem is that I have to create row headers and column headers. I created another tablelayoutpanel over the table, it would be the column header. The header would horizontally scroll simultaneously with the main table, but if I turn autoscroll on, the scollbar is visible and it is not good. If I turn off autoscroll, I can't scroll the panel from code. It would be good if I could create an independent hscrollbar and in it's scroll event I could set the header and main tablelayoutpanels scroll position simultaneously.
Have you any ideas?
|
|
|
|
|
|
Thank You! These articles are goood. Unfortunately, column spanning is still a problem.
|
|
|
|
|
Are you doing this as an on-line project hooked up to a DataBase in ASP.NET ... your use of 'TableLayouPanel suggests this is a WinForms project, while 'DayPilot is meant to be used on-line ?
Do Note that DayPilot has an open-source ASP.NET "lite" version, and a MonthPicker version available for download: [^]. You might get some good ideas studying their source code ?
My experiments with the WinForm TableLayoutPanel a few years ago found it got really slow in scrolling when trying to implement lots of Controls in lots of rows, and columns. But, maybe that was related to my using slow hardware.
Why couldn't you use Row #0 to hold Column Names, and Column #0 to hold Row Names ?
«OOP to me means only messaging, local retention and protection and hiding of state-process, and extreme late-binding of all things. » Alan Kay's clarification on what he meant by the term "Object" in "Object-Oriented Programming."
|
|
|
|
|
Thanks for answering! I am making a windows forms application. I haven't studied the daypilot's source code because it is an ASP.NET control. After your suggestion, I think tablelayoutpanel is not a good solution. So I should add a control (button or panel) to a datagridview, but that control should overlap many cells if the reservations are longer then one day.
|
|
|
|
|
KissGnv wrote: After your suggestion, I think tablelayoutpanel is not a good solution Please, note that I did not directly advise you to avoid using a TableLayoutPanel; I simply told you about my experience a few years ago with it.
I strongly advise you to check out Jing Lu's open-source ReoGrid Control which has an article on CodeProject here: [^], and a web-site here: [^]. ReoGrid does everything but walk your dog, and is very, very fast. Note that the license model for ReoGrid may have changed, on the article on CP it's LPGL; I have written Jing asking him to clarify the current license model.
Why not create a prototype to test, on the type of hardware you'll run your app on, that loads a TableLayoutPanel with as many Controls with synthesized sample data as you think you might need a maximum of, and then observe the speed of response.
Here's some code I used a few years ago: [^]. I suggest you increase the integer Constants that control the number of Rows, and Column, and observe the performance as you scroll.
To use the code in the linked to archive: 'unRar it, and copy-paste the code in Form1.cs, and LabelEx.cs into:
0. create a new WinForms project, set the Main Form, 'Form1 'DoubleBuffered property to 'true. Size the Main Form to taste. Replace its code with the code in the archive for 'Form1.cs.
1. add a Component named 'LabelEx to your Project: replace its code in the file from the archive 'LabelEx.cs.
2. On the main Form: put a TableLayoutPanel named 'testTbl: size it and set its various properties appropriately. Put a Button on the Form named 'btnCreateLayoutPanel, and set its 'Click EventHandler to use the code in 'Form1.cs.
«OOP to me means only messaging, local retention and protection and hiding of state-process, and extreme late-binding of all things. » Alan Kay's clarification on what he meant by the term "Object" in "Object-Oriented Programming."
modified 3-Dec-14 19:10pm.
|
|
|
|
|
Grids are generally a Very Bad Idea as a user interface. They can be OK in some limited instances with small amounts of data that aren't being changed often -- and with knowledgable users.
One application I tried to use a Grid for I found it completely unmanageable -- so I used a TreeView instead and suddenly everything was suddenly simple.
In either case, I prefer having the primary form display only the highest level data for each entry, then allow the user to select an entry and open a separate editing form with the details of that one item. Don't try to show everything in one place, and don't try to allow editing of everything with one giant Grid.
If you had to use the system eight hours a day with calls and guests coming in constantly, which would you prefer?
How about go to some local hotels and see what they use, what it looks like, what the users like and dislike?
|
|
|
|
|
There are 3 examples of programs, that are used in hotels.
Example 1 (A small local hotel that I visited is using this program.)
Example 2
Example 3
This model is good, beecause you see all rooms and all reservations at the same time on the screen.
|
|
|
|
|
PIEBALDconsult wrote: Grids are generally a Very Bad Idea as a user interface. They can be OK in some limited instances with small amounts of data that aren't being changed often -- and with knowledgable users. I know you are a very intelligent senior developer with strong theoretical interests, and deep expertise with data and databases, but I can't understand why you make this very broad assertion, given the almost universal prevalence of grids of one form of another (I include things like Spreadsheets, Gantt Tools, along with Data-Gridviews in the category of "grids") in every type of industry where scheduling and reservations must be modeled/implemented.
If you make that assertion, I'd appreciate ... and I'm sure other people would too ... a little more detail other than the fact you had a bad experience with using a grid. Surely, in the vast variety of grid-like software components, there must be some implementations you think are well-done ?
By the way, I share (what I believe is) your view that the MS DataGridView sucks; and, I happen to be a real enthusiast for using a TreeView (or multiple TreeViews) as a preferred UI element(s). I use a third-party commercial TreeView that just "walks the dog" ... having "switched" after years of frustration trying to bend the MS TreeView to my will.
I favor a "one data: multiple appropriate views" model; in the case of a Hotel System, I'd like the employee (who may have little formal knowledge of computer software, but adequate practical skill) to be able to quickly switch views depending on the task at hand: from checking on room availability by date ... to entering a booking ... to calculating a net cost ... to creating a summary report of day's activities, etc.
"How about go to some local hotels and see what they use, what it looks like, what the users like and dislike?" Now that's what I call "good advice:" learn from the end-user.
And, examining, closely, the most popular hotel-management systems available today, is the second piece of research I'd recommend [^].
«OOP to me means only messaging, local retention and protection and hiding of state-process, and extreme late-binding of all things. » Alan Kay's clarification on what he meant by the term "Object" in "Object-Oriented Programming."
|
|
|
|
|
|
That is called a gantt chart. I'd just find a freeware / open source gantt chart control online. These are tough to make.
|
|
|
|
|
Hello. I want to create a new node which has child node. This is not just an element. I am doing it liek this but get System.ArgumentException
XmlDocument doc = new XmlDocument();
string sNodeString = "<School>" +
"<Name></Name>" +
"<Address></Address>" +
"<Phone></Phone>" +
"<Courses>" +
"<Course></Course>" +
"<Course></Course>" +
"<Course></Course>" +
"</Courses>" +
"</School>";
XmlNode node = doc.CreateNode(sNode, "NewNode", "");
return node;
How could I do something like this? Thanks for anything.
This world is going to explode due to international politics, SOON.
|
|
|
|
|
What type is sNode , and do your parameters match one of these[^]?
|
|
|
|
|
Hi,
I have my registry key HKEY_LOCAL_MACHINE\Software\Jassim
Under Jassim key, I have list of keys, e.g. system1, system2, options, etc
System1 and System2 wil have SystemGUID value where options key will not have.
I want to loop through all keys under Jassim key and found every key which has a SystemGUID key in it to list it in a Combobox?
How can I do this please?
Thanks,
Jassim
Technology News @ www.JassimRahma.com
|
|
|
|
|
With one minute of searching within CodeProject (or using Google) you can find C# code for enumerating the contents of a Registry Key. So, why aren't you doing that ?
If you created the Key and sub-Keys using C#, isn't it pretty obvious how to use the same Classes to read them, and parse them as required ?
«OOP to me means only messaging, local retention and protection and hiding of state-process, and extreme late-binding of all things. » Alan Kay's clarification on what he meant by the term "Object" in "Object-Oriented Programming."
|
|
|
|
|
Please, don't use the registry - particularly not for new projects!
Access to the registry is now restricted, and is likely to become more restricted in future - because it was abused so much in the early days.
There are much better ways and places to store data now: have a look at this and it might help.
Where should I store my data?[^]
Bad command or file name. Bad, bad command! Sit! Stay! Staaaay...
|
|
|
|
|
Save your breath; he's been told this innumerable times, and even had a demonstration of why it won't work.
|
|
|
|
|
You really should start making use of the documentation[^] for yourself, and Google and CodeProject articles.
|
|
|
|
|
i would need to know the most effective way get the name of the application from the Registry/LocalMachine/Software/Classes/.docx/shell/Open/Command . for example from this
"C:\Program Files (x86)\Microsoft Office\Office15\POWERPNT.EXE" "%1" /ou "%u"
i would need only the 'POWERPNT.EXE'. substring and replace is not effective as the value inside appears differently. for example
"C:\Program Files (x86)\Microsoft Office\Office15\EXCEL.EXE" /dde "C:\Program Files (x86)\Skype\Phone\Skype.exe" "/uri:%l"
|
|
|
|
|