|
you can use SQLDataSource control to connect with your db..
or u can use the classes to connect (through code)
u can search on google too. for this
|
|
|
|
|
Excel.Workbook theWorkbook = this.Excelobj.Workbooks.Open(strInputFileName, 0, false, 5,
"", "", true, Excel.XlPlatform.xlWindows, "\t", false, false,0, true,false,false);
Excel.Sheets sheets = theWorkbook.Worksheets;
Excel.Worksheet excelWorksheet = (Excel.Worksheet)sheets.get_Item(1);
Excel.Range tempRange = (Excel.Range) excelWorksheet.get_Range("C1","IV1");
System.Array tempArray = (System.Array)tempRange.Cells.Value2;
string[] exchangeData = ConvertToStringArray(tempArray);
//Determining the Excel Cell data range
int totalExcCount = exchangeData.Length;
string remarkCellName = convIndexToCellName(totalExcCount+3);
string lastExcCellName = convIndexToCellName(totalExcCount+2);
//Creating a new column "Remarks" in the excel.
Excel.Range remarkRange = (Excel.Range) excelWorksheet.get_Range(remarkCellName + "1",remarkCellName + "1");
string strRemark = "Remarks";
Object[] args1 = new Object[1];
args1[0] = strRemark;
remarkRange.GetType().InvokeMember("Value",BindingFlags.SetProperty,null,remarkRange,args1);
Now as above when writing in excel
I want that I should be able to write "Remarks" with some different color say red
how can i do that
Thanks
Ankit Aneja
"Nothing is impossible. The word itself says - I M possible"
|
|
|
|
|
the get_range method itself has few poperties...
Try out the Font property and thereby you can set the color for the font!!
Gautham
|
|
|
|
|
Ankit,
Here is the Solution:
Call this line
remarkRange.Font.Color = System.Drawing.ColorTranslator.ToOle(System.Drawing.Color.Red);
and this will set the Font color to RED.
Manoj
|
|
|
|
|
To fill the color for One cell,
((Excel.Range)worksheet.Cells[row, column]).Interior.Color = ColorTranslator.ToOle(color) ;
To fill the color for range.
worksheet.get_Range("A1","A2").Interior.Color = ColorTranslator.ToOle(color);
Hope to catch well!!!
|
|
|
|
|
I am using a RichTextBox on a Form. The RichTextBox shows large amount of text from the database.
The sizes of the text varies from 0 to 1500 chars.
So I start from small size RTB (400*400) and then increase the size of the RTB untill the Scroll bars are no longer shown. i.e I want to make an automatically sizing RichTextBox
I want to just check the Vertical Scrollbar, and keep increasing the height of my RichTextBox until the scrollbar is disabled/unused (this would, in theory, give it the exact height needed)
And If is increase the size of the rTB do i have to use the method
Application.DoEvents();
to show the change
o O º(`'·.,(`'·., ☆,.·''),.·'')º O o°
»·'"`»* *☆ t4ure4n ☆* *«·'"`«
°o O º(,.·''(,.·'' ☆`'·.,)`'·.,)º O o°
|
|
|
|
|
Nice signature, I guess it's one of your rtf applications
Smile: A curve that can set a lot of things straight!
(\ /)
(O.o)
(><)
|
|
|
|
|
What is your question?
Regards,
mav
--
Black holes are the places where God divided by 0...
|
|
|
|
|
How Do I check that the Vertical Scroll bar is shown.
o O º(`'·.,(`'·., ☆,.·''),.·'')º O o°
»·'"`»* *☆ t4ure4n ☆* *«·'"`«
°o O º(,.·''(,.·'' ☆`'·.,)`'·.,)º O o°
|
|
|
|
|
I was using Visual studio 2003 to develop windows applications in c#. Now I have moved to Visual studio 2005. I wanted to use Datagrid in my application but the only thing I see is what is called datagridview. Are these two the same, if yea can I use the same code to populate a datagridview?
phokojoe
|
|
|
|
|
|
They are not exactly the same. DataGridView replaced DataGrid in Dot net 2.0. Although DataGrid is still available for use. It is apparently not available through the IDE but you can still create a DataGrid in your code should you wish but you should considder using DataGridView instead.
[Modify]
You can add it to the IDE if you right-click on toolbox and select choose items.
|
|
|
|
|
DataGridView is the replacement for DataGrid, but they are not the same. The DataGridView doesn't support displaying data in a hierarchical manner.
The code you used to populate the DataGrid should work just fine to populate the DataGridView.
-----------------------------
In just two days, tomorrow will be yesterday.
|
|
|
|
|
Hi I'm having a problem with a Service i'm trying to write...
It seems like a simple problem but i'm getting nowhere...
I'm creating a windows service that will detect files that have been added to our local server dropbox, and then move and rename the files up to our hosted remote server.
We have a VPN connection to the hosted server, and can connect to the file structure with the internal IP address. however they are on seperate domains.
This means that i cannot have 1 User with Write access to both servers and need to impersonate the users with access.
Is this possible? I have been trying and failing to use CredentialCache with NetworkCredential and LoginUser!
Has anyone got any ideas?
Thanks
Martin
|
|
|
|
|
Hi,
The NetworkCredential does not support public-key based authentication methods such as Secure Sockets Layer(SSL) client authentication.
You can check this with your VPN connection.
One more thing, why do you want to have write access at the local server for the same user ?
Manoj
|
|
|
|
|
Hi Manoj,
I needed Read/Write access To move files in both directions with the service. We have now decided to approach this in a different way, intergating it with an exsisting service, adding a webservice to accept and serve files!
Thanks for you help anyway.
Martin
|
|
|
|
|
|
blackjack2150 wrote: my application cracked and somehow I ended up with this on
Reallly!! I keep seeing this everyday that I thought it was on of VS2005 features;P
Smile: A curve that can set a lot of things straight!
(\ /)
(O.o)
(><)
|
|
|
|
|
I want to display an image in my custom control.For that i used
Image.FromFile(pathofimage)...But this statement gave an out of memory error.
This happened when i changed an xml file to format 'bmp' and loaded that image.When i saw the file it had a red crossed symbol. How can i check whether an image file is a valid image file or not?..Please help....
|
|
|
|
|
Hi,
The function "Image.FromFile" can through 2 types of Exceptions.
1)OutOfMemoryException
2)FileNotFoundException
The first exception "OutOfMemoryException" will be thrown when the file does not have a valid image format. Hence, you put the above line in a try-catch block. There is problem with file format, when you get an exception type as OutOfMemoryException.
Manoj
|
|
|
|
|
snoby wrote: when i changed an xml file to format 'bmp'
Why did you change the format of file ?
Thanks and Regards
Sandeep
If If you look at what you do not have in life, you don't have anything,
If you look at what you have in life, you have everything... "
|
|
|
|
|
Explain how you "changed an XML file to format BMP"??
|
|
|
|
|
While testing with my custom control...testers tried to rename an Xml file to Bmp file.In that extreme case , my custom control should not fail. So while fetching such a file my control failed.I can handle it in try -catch block.This i have already done.But is there any coding to restrict such exceptions from occuring ?
|
|
|
|
|
snoby wrote: testers tried to rename an Xml file to Bmp file.
Of course that's not going to work...
snoby wrote: In that extreme case , my custom control should not fail. So while fetching such a file my control failed.I can handle it in try -catch block.
That's exactly what you have to do.
snoby wrote: But is there any coding to restrict such exceptions from occuring ?
You can't predict the future. You have no choice but to handle that exception. Even if the file is intentioned to be a valid image, files CAN be corrupted, no matter what you do. You simply don't have a choice here. You MUST handle the exception.
|
|
|
|
|
Hi friends..
string str="ABC";
this means that we are assigning value to the object str of string class..right?But whn we are instantiating some class then we are assigning values to the feilds of that class(ex:Employee_1.Name="xyz",Employee_1.Id=1234,etc where Employee_1 is an object of class Employee)..thn how things are working differently for string class..I think this has to do something with user defined and predefined reference data types..
|
|
|
|