|
Its really hard way.
I download http://www.google.com/
And I read source, find <img src=images/hp0.gif width=158 height=78 alt="Google">
Than I download http://www.google.com/images/hp0.gif
|
|
|
|
|
Hi Guys. I have a slight problem. My application usses EarlyBinding.where I reference Excel 12. Problem I'm having is that most of the machines targeted have Excel 10 or Excel 11 installed so when installing the App or running it I get a GAC error. This I know is that the versions are not backward compatable. My question is, how do I go from earlybinding to LateBinding with as little changes possible. Below I instanciate my Excel Workbook etc. My code is doing loads of stuff and I wouldn't want to rewrite all of it.
Microsoft.Office.Interop.Excel.Application objExcel =
new Microsoft.Office.Interop.Excel.Application();
objExcel.Visible = false;
Microsoft.Office.Interop.Excel.Workbook objBook =
objExcel.Workbooks.Add(System.Reflection.Missing.Value);
Microsoft.Office.Interop.Excel.Worksheet objSheet =
(Microsoft.Office.Interop.Excel.Worksheet)
objBook.Worksheets.get_Item(1);
Microsoft.Office.Interop.Excel.Range objRange;
Any advice would be appreciated.
Excellence is doing ordinary things extraordinarily well.
|
|
|
|
|
You can do this using something like this:
object xl = Activator.CreateInstance(Type.GetTypeFromProgID("Excel.Application"));
object books = xl.GetType().InvokeMember(
"Workbooks", BindingFlags.GetProperty, null, xl, null);
object book = books.GetType().InvokeMember( "Add",
BindingFlags.InvokeMethod, null, books, null );
object sheets = book.GetType().InvokeMember( "Worksheets",
BindingFlags.GetProperty,null, book, null );
object[] parameters;
parameters = new object[1];
parameters[0] = 1;
object sheet = sheets.GetType().InvokeMember( "Item",
BindingFlags.GetProperty, null, sheets, parameters );
parameters = new object[2];
parameters[0] = "A1";
parameters[1] = Missing.Value;
object range = sheet.GetType().InvokeMember( "Range",
BindingFlags.GetProperty, null, sheet, parameters );
parameters = new object[1];
parameters[0] = "1";
range.GetType().InvokeMember( "Value",
BindingFlags.SetProperty, null, range, parameters );
parameters = new object[1];
parameters[0] = true;
xl.GetType().InvokeMember( "Visible",
BindingFlags.SetProperty, null, xl, parameters ); I've just knocked this together in Notepad, so I apologise if it's not 100% perfect.
"WPF has many lovers. It's a veritable porn star!" - Josh Smith As Braveheart once said, "You can take our freedom but you'll never take our Hobnobs!" - Martin Hughes.
My blog | My articles | MoXAML PowerToys | Onyx
|
|
|
|
|
Cool, looks good though. My concern is when I start writing the data, for example see below portion of code.
objSheet.Cells[iR, iC] = CLIENTSURNAME.Trim();
objSheet.Cells[iR, iC + 1] = CLIENTFORENAMES.Trim();
objSheet.Cells[iR, iC + 2] = TITLE.Trim();
objSheet.Cells[iR, iC + 3] = "'" + ADDRESSLINE1.Trim();
objSheet.Cells[iR, iC + 4] = "'" + ADDRESSLINE2.Trim();
objSheet.Cells[iR, iC + 5] = "'" + ADDRESSLINE3.Trim();
objSheet.Cells[iR, iC + 6] = "'" + ADDRESSLINE4.Trim();
objSheet.Cells[iR, iC + 7] = "'" + POSTALCODE.Trim();
objSheet.Cells[iR, iC + 8] = LEVEL;
would I need to do the same as your example above
Pete O'Hanlon wrote: // get the "range" A1.parameters = new object[2];parameters[0] = "A1";parameters[1] = Missing.Value;object range = sheet.GetType().InvokeMember( "Range", BindingFlags.GetProperty, null, sheet, parameters );
Excellence is doing ordinary things extraordinarily well.
|
|
|
|
|
Yup. It's not pretty. I'd write some helper methods to do this if I were you.
"WPF has many lovers. It's a veritable porn star!" - Josh Smith As Braveheart once said, "You can take our freedom but you'll never take our Hobnobs!" - Martin Hughes.
My blog | My articles | MoXAML PowerToys | Onyx
|
|
|
|
|
|
Hi All,
Actually the problem is there is a task to be done "taking backup of message rules for an outlook profile".
How is it done:
- In outlook Open Tools.
- Select Rules and Alerts
- In Rules and Alerts dialog select "options"
- Click "Export Rules"
- This will create a .rwz file
So now i want to create this .rwz file programatically.
If any references, please post it..
Thanks in adv,
ashok
|
|
|
|
|
Hi,
I was using ms office 2003 in window application project to display information in word format now i have updated it, now i installed 2007.
Now word file not displaying some i don't know why.
Can any one tell me what will be the problem what should i do?
Please do replay.
Thanks
|
|
|
|
|
Did you used COM to communicate with office 2003??
|
|
|
|
|
|
If your problem is solved, please post the way by which you have solved....
It may be useful for someone else sometime.....
Have a Happy Coding.....
|
|
|
|
|
Hi to everyone,
I'm just trying to pass parameter to a JavaScript function from C# code.
The parameterless function is as shown in part1, but I want it to be parametric therefore, I made a bit changes as shown in part2:
--- part1 ---
function next(){
var pass = document.getElementById("ctl17_password");
if(window.event && window.event.keyCode == 13) {
pass.focus();
return false;
}
else
return true;
}
In C# I use the below code:
UserName.Attributes.Add("onkeypress", "return next()");
THIS WAY EVERYTHING IS OK.
-------------
--- part2 ---
function next(parameter) {
var pass = document.getElementById(parameter);
if (window.event && window.event.keyCode == 13) {
pass.focus();
return false;
}
else
return true;
}
In C# I use the below code:
UserName.Attributes.Add("onkeypress", "return next(ctl17_password)"); --- BUT THIS DOES NOT WORK, I'm not also sure about passing the "parameter" variable as: getElementById(parameter);
-------------
I made some search on this issue, but couldn't find exactly what I needed. Could you please help me?
Thank you very much
Regards,
codddy
|
|
|
|
|
This is an ASP.NET question, not one for the C# forum.
Anyway, the corect way to do this it to use:
UserName.Attributes.Add("onkeypress", string.Format("return next('{0}');", password.ClientID)); Never hardcode the control name of an ASP.NET control into JavaScript methods. If you move where this control is situated, the ID changes because ASP.NET mangles the ID to ensure uniqueness.
"WPF has many lovers. It's a veritable porn star!" - Josh Smith As Braveheart once said, "You can take our freedom but you'll never take our Hobnobs!" - Martin Hughes.
My blog | My articles | MoXAML PowerToys | Onyx
|
|
|
|
|
Hi Pete, thanks a lot for your answer.
Yes, I was aware that hardcoding was wrong, but because of some urgent reasons I had to do it. Thanks again.
I would like to ask one more question.
I used your way and everything works fine locally. But on the server it does not even come to JavaScript function?
Do you have any idea about this issue?
Regards,
coddy
|
|
|
|
|
Hi,
In a form i have so many panels and controls
when i increase one panel it overrides another controls. scroll bars are not comming.
dock style is fixed at bottom.
|
|
|
|
|
hmm... interesting.
var question = (_2b || !(_2b));
|
|
|
|
|
In order to get some help you will have to describe your problem a little better.
Is this happening at run-time or design-time?
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.”
|
|
|
|
|
Its run time.
i set above controls panel's dock style is fill and
down panel's dock is bottom. (this is fixed for my requrement)...
|
|
|
|
|
In that case investigate 'Z order'.
If you are still stuck after reading up on that, post back and I will try to help.
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 I am given with a project where advertisements are added in between serials. So for that we need to first split the video file into pieces and merge it with those advertisements. Can anyone help me out in this.
|
|
|
|
|
I dont think this is the right forum to ask this.
Are you trying to split the video files with your own software written in c#???
Have a Happy Coding.....
|
|
|
|
|
Hi everyone,
I've got a dialog box with checkboxes, comboboxes and textboxes for filling in. I have it saving perfectly into my access database. On this dialog I have Load button, which opens a new dialog. This has a search textbox, a datagridview and a few buttons. The datagridview displays the contents of the database.
I would like to be able to get the information in the selected row of the datagridview and load that into the original dialog. I have tried to figure it out myself, but my C# knowledge is limited.
I don't really have any code for loading, but If i write anything i'll get it posted.
Any direction in this would be greatly appreciated.
Many thanks
Martin
|
|
|
|
|
Hi Martin,
Take a look at 'DataGridViewRow'.
That should get you started.
If you cannot get it working, post back with an example of what you have tried, and I will try to help.
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.”
|
|
|
|
|
Thanks.
I've had a play with that previously, couldn't really figure out out to implement it though, I'll just keep going.
|
|
|
|
|
Hi Martin,
The DataGridView has a property called SelectedRows , which is a collection of the rows currently selected. There is also an event called OnRowEnter . Both of these give you access to the DataGridViewRow selected by your user. What is needed is a way to track that row and make it available to your calling form when the dialog closes. So:
1. add a private field to your dialog.
private DataGridViewRow selectedRow;
2. add a public property so that it can be accessed from outside the dialog
public DataGridViewRow SelectedRow
{
get
{
return this.selectedRow;
}
}
3. If you elect to use OnRowEnter , for example, you can store the row in the private field. In the event handler:
this.selectedRow = this.dataGridView1.Rows[e.rowIndex];
then every time a new row is entered that row is stored in your field.
4. In your calling form:
if (datagridDialog.ShowDialog() == DialogResult.OK)
{
this.FillData(datagridDialog.SelectedRow);
}
private void FillData(DataGridViewRow loadedRow)
{
this.usernameTextBox.Text = loadedRow.Cells["UserName"].Value.ToString();
etc.
}
Hope this gives you some idea.
It has just occurred to me that your calling forms controls might be databound, if so this won't work, please let me know.
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.”
|
|
|
|