|
I need Readonly ComboBox in vb.net windows application, for this requirement i used to use textbox & combobox together in the same place.
TextBox Properties
ReadOnly=True
TabStop=False
ComboBox Properties
AutoCompleteMode=SuggestAppend
AutoCompleteSource=ListItems
TabStop=True
in ADD/EDIT events set ComboBox Enabled=True, if the event is done ComboBox Enabled=False
this is my code
Private Sub ComboBox1_GotFocus(ByVal sender As Object, ByVal e As System.EventArgs)
Handles ComboBox1.GotFocus
TextBox1.Visible = False
End Sub
Private Sub ComboBox1_LostFocus(ByVal sender As Object, ByVal e As System.EventArgs)
Handles ComboBox1.LostFocus
TextBox1.Visible = True
End Sub
Private Sub ComboBox1_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs)
Handles ComboBox1.SelectedIndexChanged
TextBox1.Text = ComboBox1.SelectedItem().ToString
End Sub
in design TextBox on top of the ComboBox, can see only the ComboBox Button.
Please give me any simple solution for this....
N.K.Veeramani
Software Engineer
InteriTech SDN. BHD.,
Malaysia
|
|
|
|
|
Your logic, at a form level, seems wrong. When you display the dialog you should know if CRUD is required at which point you display a combo so the user can edit the data. If the user is opening the form as RO then either disable the combo or display a textbox with the required value.
I cheat, if the user does not have CRUD rights on the form/data I make the save button invisible/disabled. The user can do what they like, just can't save the results.
|
|
|
|
|
thanks for the reply.
i will tell why i need like this
if i set ComboBox enabled=false the user can't the value clearly. thats-why i needed like that
so how to solve this
N.K.Veeramani
Software Engineer
InteriTech SDN. BHD.,
Malaysia
|
|
|
|
|
My point is why are you making the combo readonly. Simply disable the save button.
If you insist on readonly then have a textbox on display when the form is in the view only mode and swap for a combo box on the add/edit event. If the act of entering the combobox changes the state of the form to edit mode then why are you bothering to have it readonly.
|
|
|
|
|
Someone didn't like your answer...
I'll pay you back
I don't speak Idiot - please talk slowly and clearly
I don't know what all the fuss is about with America getting it's first black president. Zimbabwe's had one for years and he's sh*t. - Percy Drake , Shrewsbury
Driven to the arms of Heineken by the wife
|
|
|
|
|
Considering Yogi's answer, I didn't like it either but thanks anyway.
|
|
|
|
|
I need Readonly ComboBox in vb.net windows application, for this requirement i used to use textbox & combobox together in the same place.
TextBox Properties
ReadOnly=True
TabStop=False
BackColor=Window
ComboBox Properties
AutoCompleteMode=SuggestAppend
AutoCompleteSource=ListItems
TabStop=True
in ADD/EDIT events set ComboBox Enabled=True, if the event is done ComboBox Enabled=False - now the user can see the value clearly b'coz of textbox
this is my code
Private Sub ComboBox1_GotFocus(ByVal sender As Object, ByVal e As System.EventArgs)
Handles ComboBox1.GotFocus
TextBox1.Visible = False
End Sub
Private Sub ComboBox1_LostFocus(ByVal sender As Object, ByVal e As System.EventArgs)
Handles ComboBox1.LostFocus
TextBox1.Visible = True
End Sub
Private Sub ComboBox1_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs)
Handles ComboBox1.SelectedIndexChanged
TextBox1.Text = ComboBox1.SelectedItem().ToString
End Sub
in design TextBox on top of the ComboBox, can see only the ComboBox Button.
Please give me any simple solution for this....
N.K.Veeramani
Software Engineer
InteriTech SDN. BHD.,
Malaysia
|
|
|
|
|
I assume you want to make the combox box read only, so that user can't type in. For that try changing the DropDownStyle property to "DropDownList"
Books are as useful to a stupid person as a mirror is useful to a blind person. - Chanakya
|
|
|
|
|
I really, really hate missing the bloody obvious, all the faffing about with text boxes and events must have confused me, change the style, of course. mutter mutter bloody idiot
|
|
|
|
|
Oh please calm down.. I guessed the issue because I know how some newbie ask the question. They want to do something else and ask something totally irrelevant.
Books are as useful to a stupid person as a mirror is useful to a blind person. - Chanakya
|
|
|
|
|
you can change the dropdownstyle property of combobox to dropdownlist. Then the user will not be able to change the content.
|
|
|
|
|
that is ok but i want the same style in dropdown not in the dropdownlist
thanks for your reply
N.K.Veeramani
Software Engineer
InteriTech SDN. BHD.,
Malaysia
|
|
|
|
|
Hi friends
I am developing my project in .net framework2.0 and c#.I am using microsoft reporting services and created an rdlc file.I am using reportviewer control to load and display the report.
But I am not able to get the report and i am not getting any error.
Below is my code.
private void BindCustomersreport()
{
ds = new DataSet();
RBLL = new ReportBLL();
ds = RBLL.ShowCustomersReport(RBLL);
if (ds.Tables[0].Rows.Count != 0)
{
reportViewer1.Visible = true;
reportViewer1.ProcessingMode=Microsoft.Reporting.WinForms.ProcessingMode.Local;
reportViewer1.LocalReport.ReportEmbeddedResource = @"C:\Inetpub\wwwroot\Tirumala Gruha Nirman\Tirumala Gruha Nirman\CustomersContactList.rdlc";
reportViewer1.LocalReport.DataSources.Clear();
bindingSource1.DataSource = ds.Tables[0].DefaultView;
rpt.Name = "Customerscontactinfo_sp_showcontactlistofcustomers";
reportViewer1.LocalReport.DataSources.Add(new Microsoft.Reporting.WinForms.ReportDataSource("Customerscontactinfo_sp_showcontactlistofcustomers",bindingSource1));
// reportViewer1.LocalReport.DataSources.Add(rpt);
reportViewer1.DocumentMapCollapsed = true;
reportViewer1.LocalReport.Refresh();
}
else
{
reportViewer1.Visible = false;
}
}
Please suggest me my mistake...
With Regards
Shashi.
|
|
|
|
|
Have you stepped through your code to see if your if condition is false, therefore running your reportViewer1.Visible = false; line?
In other words, does ds.Tables[0].Rows.Count == 0 ?
Henry Minute
Do not read medical books! You could die of a misprint. - Mark Twain
Girl: (staring) "Why do you need an icy cucumber?"
“I want to report a fraud. The government is lying to us all.”
|
|
|
|
|
Hi Henry
I am getting data as ds.Tables[0].rows.count!=0
and reportviewer1 is also set to true.I am able to see the report control but not the data in the win form.
I hope data is not binding to the report or report is not loading..
|
|
|
|
|
In that case, I'm stumped.
Sorry!
Henry Minute
Do not read medical books! You could die of a misprint. - Mark Twain
Girl: (staring) "Why do you need an icy cucumber?"
“I want to report a fraud. The government is lying to us all.”
|
|
|
|
|
Hi,
Along the lines of what Henry suggested, is there data in
ds.Tables[0].DefaultView
(You said there are rows in the dataset, but how about the default view?)
Also, looking at what I've done when using the report viewer, I've also set the LocalReport.ReportPath to the path of the .rdlc file, as well as using the ReportEmbeddedResource. I'm not sure it's necessary, but maybe you can try it
|
|
|
|
|
Can WPF Controls used in normal existing windows application.?
|
|
|
|
|
|
Can you give me the way or steps to do this?
Thanks
Saurabh
|
|
|
|
|
Did you follow the link Eddy supplied "Walkthrough: Hosting a Windows Presentation Foundation Control in Windows Forms" seems to cover it.
|
|
|
|
|
hi
i am working on visual studio 2008(framework 3.5) and i want to access this exe file in another PC They are connected in networking and they have installed studio 2008.
BEST REGRADS
|
|
|
|
|
ashikale wrote: i am working on visual studio 2008(framework 3.5) and i want to access this exe file in another PC
Place it in a shared directory.
|
|
|
|
|
...and read up on Code Access Security. By default, no workstation will trust your app running from a network source. You have to tell each workstation to either trust the location the app is in, trust the app specifically, or trust the code signed with a certain key.
|
|
|
|
|
if you want to run it pragmatically then you can use socket programming to do that.
|
|
|
|