|
Hari Balaji
It's considered rude to demand code on the forums. This site is not about doing your work for you - if you want that, you should try rent-a-coder.
|
|
|
|
|
We have the Auto-hide task bar unchecked. When my window is displayed, the bottom portion is hidden behind the taskbar. Is there a way to avoid this problem and let my form be fully displayed?
I tried setting the "TopMost" property to True, but then every other window is displayed behind my window. i.e. you can not display any other window such as outlook once my window is displayed, they all pop up behind my window.
What other options do I have?
|
|
|
|
|
Get this figured out?
"The clue train passed his station without stopping." - John Simmons / outlaw programmer
"Real programmers just throw a bunch of 1s and 0s at the computer to see what sticks" - Pete O'Hanlon
|
|
|
|
|
Like ASP.NET/web form, do the windows form also have validation controls?
If not wht is the alternative option?
Thanks
Ashwini
|
|
|
|
|
I think they do, but either way, the obvious option is to have a label and write text to check if required values are present.
Christian Graus
Please read this if you don't understand the answer I've given you
"also I don't think "TranslateOneToTwoBillion OneHundredAndFortySevenMillion FourHundredAndEightyThreeThousand SixHundredAndFortySeven()" is a very good choice for a function name" - SpacixOne ( offering help to someone who really needed it ) ( spaces added for the benefit of people running at < 1280x1024 )
|
|
|
|
|
Don't you have to allocate screen space for labels in Windows Forms? What I am doing on my app is using a custom ValidateInput() method to check all my required fields/check for valid data, then create an error message based on what's wrong and display that to the user in a Dialog window.
|
|
|
|
|
Christian Graus wrote: the obvious option is to have a label and write text to check if required values are present.
Yes, it's the easy option. But I find it's hard to test when you follow TDD. I do this in other way by using ErrorProvider control and using data binding features of the input controls. Please take a look at this[^] article, it's worth reading.
|
|
|
|
|
ashwinibhalerao wrote: If not wht is the alternative option?
ASP.NET validation controls can't be used with windows forms. You have to take a look at using IDataErrorInfo interface and it's relationship with ErrorProvider control. Use data binding features of the controls, bind your business objects with it. If it implements, IDatErrorInfo , it can validate and show the error provider for the respective controls. Take a look at here[^]
|
|
|
|
|
Hi all,
I am developing a HR Portal, using vb.net 2003 & SQL 2000 for offline module.
I want to display the applied Resumes from database in the following fashion:
(checkbox) (Resume Heading) {Photograph(optional)}
(Candidate Name)
(Exp) (KeySkill)
This Is a similar format of normal job sites which displays the companyName & job Details in Short at the time of Job Application.
I want to do this using vb.net 2003 only.
So All the Experts plz say me which control I should on the form also the source code.
its a bit urgent!! deadline is near!!
Regards...
|
|
|
|
|
How about a data grid?
ketan bader wrote: its a bit urgent!! deadline is near!!
suprise suprise!
Bob
Ashfield Consultants Ltd
|
|
|
|
|
Hi,
I designed one window form in that 4 text box(ID, Name,Designation,Contactno,) and one drop down box("Visible", "Invisible") and two button call "Add value","Search" .
And gridview to add value from text and drop down control.
1.The value which I enter in text box and value selected from drop down box, should be get added in gridview as soon as I enter "Add" button.
2.I will write name in text box and click on "search" button to search other information from gridview.
I don't know wht to write code without using db,
Plz help me to solve this problem
Thanks in advance
Ashwini
|
|
|
|
|
Hi Ashwini,
You may try the following code snippet on Click event of Add Button:
BEGIN CODE
DataGridView1.Item(RowIndex, ColIndex).Value = Me.TextBox1.Text
Or
DataGridView1.Item(RowIndex, ColIndex).Value = Me.ComboBox1.Text
END CODE
Hope this help
Regards,
John Adams
ComponentOne LLC
|
|
|
|
|
I've tried searching to see if this question has been asked before, but the search is not working for some reason.
Does anybody know of an easy way to detect if a displayed record has been altered by the user? When we display a screen to the user with data from the DB, we want to know if they have altered any data so if they close the screen without saving we can prompt them to save. My first though was to wire up each control's "value changed" event and set a custom property to show that the record had been altered. That's not bad except I've got an average of 30 controls per form and am dealing with around 20 forms. There's got to be an easier way. Is there some kind of form-wide "value change" event that I can catch?
|
|
|
|
|
FyreWyrm wrote: There's got to be an easier way.
There is.
FyreWyrm wrote: Is there some kind of form-wide "value change" event that I can catch?
No. But if you used DataBinding then the Data Source you are bound to would actually keep track and you can use a method/property of the DataSource to find out if it has been modified.
FyreWyrm wrote: I've got an average of 30 controls per form and am dealing with around 20 forms.
Is there some reason you are not using controls like tree/list/grid/PropertyGrid? These can greatly reduce the number of forms and controls needed to allow users to modify data.
led mike
|
|
|
|
|
led mike wrote: if you used DataBinding
I'm curious as to how this would work. I did a datagrid once that I bound to a table in a DataSet and kept track of modifications that way. That was thrown back into my face by the standards review committee at work. They said we don't do data binding on controls but specifically set their text based on fields contained in a "business" object. I haven't used data binding since. I'll do some looking on this and see what I can figure out. Thanks.
The forms I'm dealing with are mainly contract detail forms. There are tons of fields in the contracts and each field has its own field in the record. When the detail is displayed, each field has to have its own control.
|
|
|
|
|
You can bind to a "business" object, and have the business object keep track of changes (by having a _old value).
DataBinding has their pro and con
Pro: You get to have the value changed in business object as soon as the value is changed.
Con: Due to the pro, sometime you need to be very careful of the sequence of change, especially is the changes triggers calculation which trigger changes, etc
Setting and Saving values manually
Pro: Doesn't has the DataBinding con:
Con: Quite a lot con. Data changes is not populated back to the BO, so you may have code that manually repopulate part of the data to do some processing, aka, data out of sync between UI and BO.
|
|
|
|
|
FyreWyrm wrote: each field has to have its own control.
Why?
led mike
|
|
|
|
|
Well, think about what's on a contract. Just the first little section, purchaser's Last Name, First Name, Address 1, Address 2, City, State, Zip-Code, Home Phone, Work Phone, Cell Phone is 10 textbox controls. Plus, this is taking the place of a very old Access application and the end users are very adament about it looking exactly like what they currently have.
|
|
|
|
|
FyreWyrm wrote: Just the first little section, purchaser's Last Name, First Name, Address 1, Address 2, City, State, Zip-Code, Home Phone, Work Phone, Cell Phone is 10 textbox controls.
Or 1 PropertyGrid control. You can edit almost any data using a single PropertyGrid control. Furthermore you can use things like trees etc., to navigate the hierarchy of your data and at each navigation point you can edit that subset of the data in the same PropertyGrid control. Do you use Visual Studio? Did you not notice how the same control provides editing for all the data in your project?
led mike
|
|
|
|
|
Sorry, I don't know anything about PropertyGrid s. This is the first Windows app ever developed by my company (and it's for internal use only). Furthermore, this is the first coding project I've been involved with. Up until now my career as a "programmer" (programmer in title only) has been limited to writing documentation for old web apps. But I'm enjoying my freedom with this one. I'm learning a lot.
|
|
|
|
|
A code-saving technique that few developers seem to be aware of is that you can wire multiple events to a single event handler. You can make each control's Changed event call the same function.
Visual Studio's designers don't make this very easy, but you can enter the same function name in the Events part of the Properties pane for each control.
DoEvents: Generating unexpected recursion since 1991
|
|
|
|
|
I've played around with this approach some and it's driving me up the wall. Apparently, the TextChanged event fires for a control when you programmatically change the text also. So when the form loads and I clear all the fields, the event fires for each field there. Then when I display a record, the event fires for each field there. Is there any way to suspend the firing of events on a form (like the suspend layout functions) while I manipulate the fields in the code? That would prevent unnecessary firing of this event. Thanks for your help.
|
|
|
|
|
You could unbind all events and rebind them afterwards but that isn't very good. Just set a flag (private boolean member) before you fill all your controls. In the changed event just check if the flag is set and do nothing if it is. After you have updated all controls just reset the flag:
private bool _inFill;
public void Fill(SomeClass data)
{
try
{
_inFill = true;
} finally
{
_inFill = false;
}
}
private void AllControlsChangedEventHandler(object sender, EventArgs e)
{
if (_inFill)
return;
}
|
|
|
|
|
FyreWyrm - the approach we take is to have our business objects implement the INotifyPropertyChanged interface.
public class Customer : INotifyPropertyChanged
{
private int _id = 0;
private string _customerName = string.Empty;
public event PropertyChangedEventHandler PropertyChanged = new delegate { };
private void PropertyChanged(string value)
{
PropertyChanged(this, new PropertyChangedEventArgs(value));
}
public string CustomerName
{
get { return _customerName; }
set
{
if (value != _customerName)
{
_customerName = value;
PropertyChanged("CustomerName");
}
}
}
} Any change to CustomerName will result in a property changed notification being raised. If you take a look into databinding (Link[^]), then you should find you can gain a real headstart.
|
|
|
|
|
Wow, thanks for the info Pete. I think this is the way we will end up going.
|
|
|
|