|
Hi everybody!
I have added items to the DataGridViewComboBoxColumn and the value that I want to set is one of the values in the items list. This is my code:
DataGridViewComboBoxColumn cb = new DataGridViewComboBoxColumn();
cb = CreateComboBoxColumn("Category");
cb.Items.AddRange(new string[] { "Mr.", "Ms.", "Mrs.", "Dr." });
dataGridView.Columns.Insert(1, cb);
dataGridView.Rows[0].Cells[1].Value = "Mr.";
I want to see as the selected value in the combobox “Mr.”. Once I load the form the combobox doesn’t show a selected value. I have to drop the combobox to see the items.
Any suggestion is very welcome,
Elvia
|
|
|
|
|
Hi,
I have been debugging my windows application. I have found that the code in the previous post is working as I expected, because I see the variable in the Watch window.
I have the code of the previous post in the Load() method of the form class (FrmTestCases.cs) that has my DataGridView.
But when the debugger leaves the file that has this code (FrmTestCases.cs) to return to the file that called this code (FrmExplorer.cs), the value that I set in that cell by the code is lost and set automatically to null.
When the value was lost I set it in this watch window and the ComboxBox selected the value I set.
I don't know whether the problem is because I removed and then added this column (see the first post). At the end of the Load() method I have this line: dataGridView.AutoGenerateColumns = false; if I don't use it, the column that I removed appears again. Any idea about why the value of the DataGridComboBoxColumn is changed to null automatically and how to solve it?
Best Regards,
Elvia
|
|
|
|
|
I have a situation in which i have to pass reference to a form at run time. The two conditions which must be followed the project are :-
1. The calling (parent) form will be dynamic and the called (child) form will be a static one.
2. The called form may return a value to the calling form.
I have studied about and also explored abt in on net but the response i m getting abt it is that, i cannot refer to parent form's properties/methods/variables from child form untill i have a reference to it and i cannt get reference of it (parent form) since its referenced on run time therefore i dont know what will be the parent form and its variables.
Sample code : -
Instance of Child form created and showed.
frmList list = new frmList();
list.frmFromName = this;
list.Show();
Passing a value via the child form instance to parent form....
public Form frmFromName=new Form();
frmFromName.nMasterId = Convert.ToInt32(dataGridView1.Rows[nRowIndex].Cells[0].Value);
abhinav
|
|
|
|
|
|
Hello, I am very much a beginner coder - 2nd week!
I would like to create a custom tooltip. The tooltip contains an icon, a title, some additional text and a gradient background that is semi-transparent.
All help is greatly appreciated.
|
|
|
|
|
You could subclass from Tooltip , set the OwnerDrawn property to true and handle the Draw event.
/ravi
My new year's resolution: 2048 x 1536
Home | Music | Articles | Freeware | Trips
ravib(at)ravib(dot)com
|
|
|
|
|
Hi all,
Can anybody help for my requirement ? . I will appreciate that. My requirement is as follows.
1. I have a data in excel sheet . The example data what I have is like this
2004 Sales 2005 Sales 2006 Sales 2007 Sales
1 1 5 2
2 20 10 4
3 30 15 6
4 40 20 8
5 50 25 10
6 60 30 12
7 70 35 14
8 80 40 16
9 90 45 18
I wanted to generate the charts for the columns 2004sales and 2005 sales seperately and 2004 sales and 2006 sales and 2004 sales and 2007 sales .
All the charts I need to generate seperately . and put them on excel sheet .I wanted to use C# code . The code what I have is as follows.
object missing = System.Reflection.Missing.Value;
Excel.Workbook workBookObject = null;
Excel.Range oResizeRange = null;
Excel.Worksheet excelWorkSheet = null;
Excel.Worksheets excelSheets = null;
Excel.Application excelApp = null;
excelApp.Visible = true;
string workbookPath = "D:/osxpasql12.xls";
workBookObject = excelApp.Workbooks.Open(workbookPath,
0, false, 5, "", "", false, Excel.XlPlatform.xlWindows, "",
true, false, 0, true, false, false);
//excelSheets = excelWorkbook.Worksheets;
//excelWorksheet = (Excel.Worksheet)excelSheets.get_Item("osxpasql12");
Excel.Chart xlChart = (Excel.Chart)workBookObject.Charts.Add(missing, missing, missing, missing);
xlChart.ChartType = Excel.XlChartType.xlLineMarkers;
Excel._Chart oChart = (Excel._Chart)workBookObject.Charts.Add(missing,missing,missing,missing);
//Excel._Chart oChart = (Excel._Chart)workBookObject.Charts.Add( missing, missing, missing, missing );
oChart.ChartWizard( oResizeRange, Excel.XlChartType.xl3DColumn, missing, Excel.XlRowCol.xlColumns, missing, missing, missing, missing, missing, missing, missing );
---------------------------------------------------------------------------------------------------------
with the above code its taking the range . I need a solution where we can read individual columns and generate charts individually.
Any solutions please help me.
Thanks in advance .. Aparna
Aparna
|
|
|
|
|
I'm new to C# and am struggling to find a solution to sending a byte array in a SOAP message. I've used the BinaryFormatter to create the byte array but that doesn't appear to be something I would use to send via a SOAP message. We did this from Java as a test case and I've included the below message that we are trying to create as an example.
Any help would be greatly appreciated.
Thanks!
- <soap-env:envelope xmlns:soap-env="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
- <soap-env:body>
- <ns1:getemployeesforplantbyteresponse xmlns:ns1="http://mycompany/service/ws/EmployeeService.wsdl" soap-env:encodingstyle="http://schemas.xmlsoap.org/soap/encoding/">
<return xmlns:ns2="http://schemas.xmlsoap.org/soap/encoding/" xsi:type="ns2:base64">PEVtcGxveWVlTGlzdD4KICA8ZW1wbG95ZWVzPgogICAgPEVtcGxveWVlPgogICAgICA8Zmlyc3ROYW1lPk1hcmNpYTwvZmlyc3ROYW1lPgogICAgICA8bGFzdE5hbWU+Qm9nbmVyPC9sYXN0TmFtZT4KICAgICAgPGRlcHRSZXB0VG8+MDE4ODQ8L2RlcHRSZXB0VG8+CiAgICAgIDxkZXB0U3VmZml4PjA8L2RlcHRTdWZmaXg+CiAgICA8L0VtcGxveWVlPgogIDwvZW1wbG95ZWVzPgo8L0VtcGxveWVlTGlzdD4=
|
|
|
|
|
I have a text file that I am scanning through. The is a date in the format mmddyy(no slashes). How to I convert this into a datetime structure? datetime dtex = new datetime(mm,dd,yy)? Thanx in advance!
Jude
|
|
|
|
|
|
I get the following error with DateTime.Parse :
An unhandled exception of type 'System.FormatException' occurred in mscorlib.dll
Additional information: String was not recognized as a valid DateTime.
In the debugger, the string strBDate has the value of 01011900.
Jude
|
|
|
|
|
TheJudeDude wrote: strBDate has the value of 01011900.
String was not recognized as a valid DateTime.
Which means you need to parse it yourself.
/ravi
My new year's resolution: 2048 x 1536
Home | Music | Articles | Freeware | Trips
ravib(at)ravib(dot)com
|
|
|
|
|
got it! Thanx!
Common sense...the least common of the senses used
Jude
|
|
|
|
|
|
with this code i copy from one DBF to Another DBF.
but how can i Copy DBF file to MDB
this exapple is working fine
string ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" + APP_PATH + "\\TMP ;Extended Properties=dBase IV";
OleDbConnection DBConnection = new OleDbConnection(ConnectionString );
InsertQuery = "INSERT into "+APP_PATH+"\\TMP\\"+DBFfile.ToString()+" Select * from "+APP_PATH+"\\"+DBFfile.ToString();
OleDbCommand InsertCommand = new OleDbCommand(InsertQuery,DBConnection);
DBConnection.Open();
InsertCommand .ExecuteReader();
DBConnection.Close();
this one i need help, do i have to make a connection to DBF file ?
string ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source="+Application.StartupPath+"\\MainDB.mdb";
OleDbConnection DBConnection = new OleDbConnection(ConnectionString);
string InsertQuery = "INSERT into GNDSALE Select * from D:\\GNDSALE.DBF ";
OleDbCommand InsertCommand = new OleDbCommand(InsertQuery,DBConnection);
DBConnection.Open();
InsertCommand.ExecuteReader();
DBConnection.Close();
-- modified at 14:18 Wednesday 3rd May, 2006
|
|
|
|
|
Hello everyone,
i'm working on a program that uses Crystal Reports.
How can i print the report without using the CrystalReportViewer control?
The only way i know to print a report is using that component and hit the print button on it. Is there another way without see the preview of the report?
Thanks in advance.
Enrico
VentoEngine corp.
Program your life ^^
|
|
|
|
|
Hi
No problem with CrystalReportViewer for print the report.
just use following code to print.
CrystalReport1.PrintToPrinter(no.of copies,bool collated,start page,end page);
|
|
|
|
|
HI,
Can anyone tell me how to get the total physical memory(The one displayed on the task manager) and the system cache info too.
|
|
|
|
|
|
I am having trouble using the ListView.ListItems.Insert() method. When I create a new listview item, and use the Insert method with an index of let's say 0 to be the first item in the listview, it automatically appends to the end of the listview. I've just about given up. Is there a property I need to set or something? Below is a code snippet to give you an idea. Any help would be appreciated. Many thanks.
(There is an ImageList associated with the ListView control with at least 3 images.)
<pre>
private void Whatever()
{
listView1.Items.Add("One", 0);
listView1.Items.Add("Two", 1);
listView1.Items.Add("Three", 1);
ListViewItem lstvwitm = new ListViewItem("Inserted", 2);
listView1.Items.Insert(0, lstvwwitem);
}
</pre>
Garrett
|
|
|
|
|
The Insert method will indeed insert at index 0 of the ListView however if you are in Large/Small Icon view mode then by default the "AutoArrange" property will be set to "True" so it's going to sort the item regardless of the fact that you inserted it at index 0.
Also check the "Sorting" property of the ListView control to make sure its set to "None" (the default).
|
|
|
|
|
Thank you for the response. You are absolutely right. I did a Debug.WriteLine(listView1.Items[i].Text) and it printed the ListItems in the order that I was inserting them into the collection. After the insert method, I explicitly changed the properties of AutoArrange and Sorting to false and None, respectively, and it still sorted them (Using Large Icon view). I also tried to change the properties before I used the insert method. Is there any way to stop the ListView from auto-arranging or sort by index number? Thanks.
Garrett
-- modified at 15:11 Wednesday 3rd May, 2006
|
|
|
|
|
This is a kinda weird one then Garrett.. I've been trying to replicate the same issue here with a ListView using both Large Icon and Small Icon and have not been able to repro the sorting error. The icons and values of the indexes are being placed into the ListView exactly as expected (using the same code you supplied in your first post).
If you're still having this issue I would do a line-by-line debug of each insert and step into each "Add" and "Insert" (F11) to see if you can catch where it goes bad --
|
|
|
|
|
Tell me about it. That is why I posted to the forum. I did figure out how to fix the problem yesterday. I created a class that inherits the IComparer interface and then used the ListViewItemSorter to sort by index. This actually worked better because now I can sort it whichever way I want to. I got the idea from this website for anyone who had the same problem I did:
http://support.microsoft.com/kb/319401/EN-US/[^]
I just substituted the ObjectCompare to an Integer Comparison and used the ListView.Index instead of the text. It works great and now I can customize my sorts to however I want. Thanks for the help Travis.
-Garrett
|
|
|
|
|
hello all i need help
iam zidan from egypt
and i love programming so much and i want to learn how can i start
i hear about C# and more, i want some one help me , how can i start
and thank you all
my mobile num is ( +20104893140 )
Best Regard
A.Zidan
zidan
|
|
|
|