|
You can't replace a control, but you can create a new one and remove/hide the old. So in your code, create a new usercontorl2, add it to forms controls, place it in the right position and remove the usercontrol1 from forms controls.
If you're using other containers inside the form (for example tabpage), place the control to the right containers controls collection.
|
|
|
|
|
I have added one combobox column to datagrid view in my windows application.
In Combobox items added is 1,2,3,4,5
even the items has been added it doesn't Display anything in my combobox.When i click on arrow of combobox column,it shows added items 1,2,3,4,5
I want atleast one item must be displayed there in combo box by default.
i.e There must be one selected item.
|
|
|
|
|
Set SelectedIndex to other than -1 when you create the column.
Is the column bound?
|
|
|
|
|
first of all thanks for answer darkelv.
For datagridview combobox column there is no selected
index property.
yes it is bound.
I has set displaymember,Valuemember property according to i need it.
|
|
|
|
|
Maybe check if the binding is bound to the correct item/property.
Here's a sample of my code that is bound to an array of enum
Edit: Are you using comboBoxColumn.Items.Add() instead of setting DataSource?
public static AtomDataGridViewComboBoxColumn StatusGridViewColumn(Atom.Interface.ILocale locale)
{
AtomDataGridViewComboBoxColumn status = new AtomDataGridViewComboBoxColumn();
status.DataPropertyName = "Status";
status.HeaderText = LocalText.GetText(locale, LocalID.Create("ChequePrint.Master.Cheque_Status"), "Status");
status.Name = "Status";
status.SortMode = DataGridViewColumnSortMode.Automatic;
status.ReadOnly = false;
status.Width = 90;
status.DefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleLeft;
status.DefaultCellStyle.Format = "";
#region .:BE831DCA-BCDC-4294-8634-E33D8C66E51E [Status]:.
ArrayList a = new ArrayList();
a.Add(StatusTypes.Outstanding);
a.Add(StatusTypes.Issued);
a.Add(StatusTypes.Cleared);
a.Add(StatusTypes.Void);
Array enums = a.ToArray(typeof(StatusTypes));
status.DataSource = enums;
#endregion .:BE831DCA-BCDC-4294-8634-E33D8C66E51E [Status]:.
return status;
}
|
|
|
|
|
DataGridViewComboBoxColumn DataGridViewComboBoxCell doesn't have selectedindex or selectedvalue, so you must use Value property instead.
modified on Friday, January 23, 2009 5:05 AM
|
|
|
|
|
Is it possible to add full DataGridViewComboBoxColummn to DataGridView with the use of DataGridViewComboBoxCell.
modified on Friday, January 23, 2009 6:11 AM
|
|
|
|
|
My bad, I didn't mean the column but the cell. DataGridViewComboBoxCell has the value property and it doesn't have selectedindex or selectedvalue.
|
|
|
|
|
Is it possible to add full DataGridViewComboBoxColummn to DataGridView with the use of DataGridViewComboBoxCell.
|
|
|
|
|
I don't quite understand your question. The DataGridViewComboBoxColumn represents the column itself while the cells is one cell in that column on a specified row.
I think there's a very good example here: DataGridViewComboBoxColumn Class[^]
|
|
|
|
|
Can you please try this :
Dim rowCounter as Integer = 0
With CType(Grid.Rows(rowCounter).Cells(0), DataGridViewComboBoxCell)
.Items.Add("1")
.Items.Add("2")
.Items.Add("3")
.Items.Add("4")
.Value = .Items.Item(ind)
End With
Hope this will answer your query
|
|
|
|
|
Hi All,
Kindly suggest me how i use same database file from different Computers. i am using mssql express 2005 with vb.net.
thanks
rmshah
Developer
|
|
|
|
|
Please try these steps :
1. Put the database file (*.mdf) in shared location, and give Full Control to users
Who will use connection e.g. ASPNET user or any machine user in case of windows application.
2. Then use following connection string :
SqlConnection conn = new SqlConnection(@"Data Source=.\SQLEXPRESS;AttachDbFilename=<unc-path-to-database-file>;Integrated Security=True;Connect Timeout=30;User Instance=True");
3. Although this may not recommended solution, but It works.
dnpro
"Very bad programmer"
|
|
|
|
|
|
Hello all,
Can any body helps me to find a code for getting files from subfolders or files inside that subfolder.
i know code to get files from folders and subfolders. But if many folders are there, my code fails i.e. folder/subfolder/subfolder/...
i am not sure how many subfolders are there inside a folder
i need the code for getting file from folder/subfolder/subfolder/subfolder..
i am using these code for getting files inside subfolder
For Each fld In path.SubFolders
For Each fil In fso.GetFolder(fld.path).Files
If Right(fil, 3) = "txt" Then
fileNameArray1(fileCounts) = fil
fileCounts = fileCounts+1
End If
Next
Next
please try give the code for getting files inside folder/subfolder/subfolder/subfolder/..
Thanks and regards
Jishith
|
|
|
|
|
You need a recursive function. This[^] KB article show how to do it in C#. Same can be ported to VB.NET.
|
|
|
|
|
The article mentioned in previous reply is perfect call for this situation.
But, Now .NET supports recursive search by using simple code snippet. Have a look in following code snippet :
Dim myFiles() As String = Directory.GetFiles("C:\Temp", "*.*", SearchOption.AllDirectories)
If myFiles.Length > 0 Then
'Do process list of files retrieved
End If
dnpro
"Very bad programmer"
|
|
|
|
|
|
moonshaddow wrote: Error: Illegal characters in path.
Looks like some bad data. What My.Resources.mages returns?
|
|
|
|
|
N a v a n e e t h wrote: What My.Resources.mages returns?
My.Resources.mages is i txt file i put in resource manager, sorry for not explaining myself before
J.Hardy
|
|
|
|
|
I'm beginning to work on a piece of code generation. It's primarily for C#, but I thought I'd include support for VB because I'm a nice guy.
Do I understand correctly that VB doesn't support partial classes?
Add: Thanks for the answers, guys.
modified on Thursday, January 22, 2009 4:19 PM
|
|
|
|
|
|
You really think VB programmers don't do things by halves?
|
|
|
|
|
Sure does. VS2005 (.NET 2.0) and above...
|
|
|
|
|
I am posting this questions here because I am a vb .net programmer that is writing a vb .net program that needs a third party software.
I was wondering if anyone here knew of any software that can do the following.
I have a PDF with and image of a shipping label. I want to read the hub number from it.
My proposed solution: Find 3rd party utility that i can call from my program to read the image and get me the hub number data. But, I have search many hours trying to find a software that has commandline plus use ocr to read image plus be able to red image from a pdf.
Any suggestions?
Thanks
|
|
|
|