|
See that's why I skulk around here, I have used the table.copy method to achieve this in the past as I have never used a bindingsource as a datasource for a combo.
Thanks Dave
Never underestimate the power of human stupidity
RAH
|
|
|
|
|
Glad it'll help you. It's just a little something I found in someone elses brain droppings.
|
|
|
|
|
Dave Kreskowiak wrote: It's just a little something I found in someone elses brain droppings
Yikes. The things you poke in.
Luc Pattyn [Forum Guidelines] [My Articles]
The quality and detail of your question reflects on the effectiveness of the help you are likely to get.
Show formatted code inside PRE tags, and give clear symptoms when describing a problem.
|
|
|
|
|
I want to handle Edit and update both from one Button control in Winform2008, let me know , how can I do this….
Vinay
|
|
|
|
|
Set/check the text of the button in the onclick event.
Bob
Ashfield Consultants Ltd
Proud to be a 2009 Code Project MVP
|
|
|
|
|
Not enough information to answer your question. The biggest problem with this design is how is the button click handler going to know the difference in the users intent when the button is clicked??
|
|
|
|
|
Keep a Form level variable to get the mode of the screen.
private String mode = "Edit";
Now change this mode whenever, your form's mode is being changed.
Based on this private varible you can decide the text of the button.
btnSave.Text = (mode == "Edit")?"Edit" : "Update";
Hope this yould help you.
Regards,
Arindam Sinha
|
|
|
|
|
This question is as old as the dawn of windows itself, but this time round with more parameters added. I know all about SDI and MDI development, but I want to rest a case of which is best in terms of processing power. I have used both in my developing career and fully understand the pains and gains of each except:
In terms of .NET 2+ and C#:
Which is best in terms of performance: a MDI with a menu bar and two child forms - no matter the content - or two SDI's with the same menu bar and corresponding content. Forget the effeort to link the forms and carra data over from the one to the other - performance only, processing power, memory usage/footprint, JIT, GC etc.
The real reason for this is I need to have some expert advice to shut some mouths shooting off in only one direction. If you can point me, give expert advice, direction or whatever to state a case I'll appreciate it dearly.
|
|
|
|
|
In my opinion since MDI would require three forms (one father and two childs), the memory footprint will sure be slightly larger.
The same goes for computing power, since there will be three forms, all with their message management and so on.
But I doubt this will have any serious impact on the application, unless you are counting bytes or CPU cycles. And if you are doing that, you're better off using C++ or some other lower level language.
I think the real question is: how would you implement your solution with MDI and with SDI, and which would be the most performing / better ? You may discover that the changes in the implementation carry some benefit for one or the other. So the choice would depend on that, not on religion wars between SDI and MDI.
2+2=5 for very large amounts of 2
(always loved that one hehe!)
|
|
|
|
|
I have similar thoughts - no wars. Figure out what you want to use and use the appropriate method - 6 of the one and half a dozen of the other in terms of usability and performance. The other option is WPF, but in my case it will not work properly in a Terminal Services / Citrix environment - bandwidth too expensive...
"the confused are confused beyond confusion" - Pik Botha (1990)
|
|
|
|
|
Already you got couple of answers. I would like give you another link - Composite UI Application Block[^].
Using this, you can concentrate on application development and leaving the rest of the things on Microsoft's Patterns and Practices team.
Let me know if this helps or if you need any details on CAB/SCSF[^].
Regards,
Arindam Sinha
|
|
|
|
|
Using VB.net...
I've built a utility that grabs the frames from a multi-frame .tif or gif so I can save them to individual files. In one file (a tif fax document) the dimensions are reversed - 11 x 8.5 instead of 8.5 by 11. Text orientation is correct, but not the dimensions.
I assume the problem is on my end because when I open the file in Irfanview it displays correctly. None of the other TIFs I'm testing with are fax documents, and they display correctly. Worth noting that both Paint.net and MS Paint have the same problem I'm having.
Anyone have an idea as to the root of the problem?
|
|
|
|
|
Hi,
I checked the TIFF specification[^] and it seems (page 36) TIFF has an Orientation field with 8 possible values; only "1" is supported in baseline TIFF, the others are extensions. So I would guess your specific TIFF file uses an extended value, your utilities support the extension and your app does not.
If this is a one of, maybe it's best to just use a utility to convert to baseline TIFF. Otherwise fix your code (that is assuming GDI+ knows about the orientation extensions, I can't tell right now).
Luc Pattyn [Forum Guidelines] [My Articles]
The quality and detail of your question reflects on the effectiveness of the help you are likely to get.
Show formatted code inside PRE tags, and give clear symptoms when describing a problem.
|
|
|
|
|
Thanks much. Will dig deeper into the tiff specs and see if I can get at the field.
|
|
|
|
|
Hi,
Is it possible to find out file location using C language in Windows programming?Is there any function in C language which can display the file location?
|
|
|
|
|
No, there isn't. You'll either have to write code to use Windows Search[^] or to search the drive yourself, recursing through the filesystem until you find the file you want.
|
|
|
|
|
hi Dave Kreskowiak,thanks for suggestion.
|
|
|
|
|
Hello!
I have a custom collection editor which inherits after CollectionEditor class (System.ComponentModel.Design)and I want to programmatically add items to it's collection (listbox).
There is a method 'AddItems' which takes a collection object and items to add, but I cannot figure out what collection object I should pass to it.. So my question is, how I can get to CollectionEditor's inner item's list?
[update]
Ugh.. proper method name is 'SetItems'
[/update]
[update 2 - source code]
public class MyCollectionEditor : CollectionEditor
{
private Type m_itemType = null;
public MyCollectionEditor(Type type)
: base(type)
{
m_itemType = type;
}
protected override CollectionForm CreateCollectionForm()
{
Button buttonLoadItem = new Button();
buttonLoadItem.Text = "Load from DB";
buttonLoadItem.Click += new EventHandler(ButtonLoadItem_Click);
m_collectionForm = base.CreateCollectionForm();
TableLayoutPanel panel1 = m_collectionForm.Controls[0] as TableLayoutPanel;
TableLayoutPanel panel2 = panel1.Controls[1] as TableLayoutPanel;
panel2.Controls.Add(buttonLoadItem);
return m_collectionForm;
}
private void ButtonLoadItem_Click(object sender, EventArgs e)
{
if (m_itemType.Equals(typeof(MyCustomCollection)))
{
MyCustomItem item = ...load from DB...
SetItems( -> what goes here?! <- , new object[] { item });
}
}
}
[/update]
A man has got to know his limitations.
Harry Callahan
modified on Tuesday, July 28, 2009 6:34 AM
|
|
|
|
|
I've found solution thanks to .NET Reflector and reflection mechanism. Instead of using SetItems method I'm invoking private method of CollectionForm:
private void AddItems(IList instances) , like this:
MethodInfo methodInfo = m_collectionForm.GetType().GetMethod("AddItems", BindingFlags.NonPublic | BindingFlags.Instance);
methodInfo.Invoke(m_collectionForm, new object[] { });
PS. See the rest of code in previous post...
A man has got to know his limitations.
Harry Callahan
|
|
|
|
|
I've never written a program before but I've decided to do one using C#. I want a good looking (and free) UI, and I've decided to use either Windows Forms or WPF. I know WPF is snazzy, but can't a UI built on Windows Forms with only free components look good too?
I've read that Paint.net was built on Winforms, but I don't think the UI is very attractive. It's just Windows-style. Are there any fresher looking programs whose UI's show how good Windows Forms can look with all free components?
Thanks.
modified on Tuesday, July 28, 2009 12:12 AM
|
|
|
|
|
If you've never written an application before, then diving straight in with a barrel load of custom controls and trying to generate a snazzy interface probably isn't the best way to learn...
you may get something that "looks" good, but you're likely to have not learned anything from doing so!
[edit]also.. don't duplicate your posts. you'll get eaten by the admins [/edit]
modified on Tuesday, July 28, 2009 6:35 AM
|
|
|
|
|
Sk93, thanks for the reply. I know my ignorance is showing, but you're saying it complicates things to use custom controls? Can you tell me in what ways and to what degree?
Thanks again.
|
|
|
|
|
That depends on the quality and complexity of the custom controls you use.
Some have a nice object model that is easy to use and works very well. Others will probably force you to come up with your own work arounds or use other data objects besides the ones in the .NET Framework. Documentation may be lacking or non-existant. Support for those controls is going to come from the manufacturer of them, not any public forum like CP. ...
|
|
|
|
|
Thanks Dave. So you happen to know how Krypton[^] ranks in quality and complexity? These are the coolest free controls I've seen, and if feasible and if I don't find any better options, I'd like to use them
|
|
|
|
|
They look relatively well documented.
However, i may be wrong.. but they look very similar to the standard WPF controls...
|
|
|
|