|
Hi,
I am trying to open an existing excel spreadsheet which has an Addins.
When I open it using .net code, it opens the file but the addins does not appear in the file.
So, after doing some search, I found there is a VBA code which does what I want but unfortunately I do not know how to add this VBA code to my .net code.
I am using c# but you can let me know the code in vb.net if you prefer.
Thanks
Here is the VBA which is supposed to have the Addins in the excel file:
Dim oAddin As AddIn
Dim oTempBk As Workbook
Set oTempBk = Workbooks.Add
Set oAddin = oXL.AddIns.Add("C:\blp\blp.xla", True)
oAddin.Installed = True
oTempBk.Close
In case you are interested, I am using c# to open my current excel file:
Microsoft.Office.Interop.Excel.Application EApp = new Microsoft.Office.Interop.Excel.Application();
Microsoft.Office.Interop.Excel.Worksheet WS = ((Microsoft.Office.Interop.Excel.Worksheet)(EApp.Workbooks.Open(@"C:\MarketAnalytics\YieldsSpreads\YieldsSpreads.xls",
Type.Missing, Type.Missing, Type.Missing, Type.Missing, Type.Missing, Type.Missing, Type.Missing, Type.Missing, Type.Missing, Type.Missing, Type.Missing, Type.Missing, Type.Missing, Type.Missing).ActiveSheet));
EApp.Visible = true;
|
|
|
|
|
hi
how can i open outlook and send mail usin c# code ?
thank's
|
|
|
|
|
Why would you want to open Outlook for that? Feel free to browse this[^]
Cheers,
Vikram.
"I will put my new found knolage to good use" - Captain See Sharp.
"Every time Lotus Notes starts up, somewhere a puppy, a kitten, a lamb, and a baby seal are killed." - Gary Wheeler.
|
|
|
|
|
You shouldn't use Outlook for that. What is wrong with the correct responses here[^] and here[^] that pointed you in the right direction to get your job done? Are you still trying to get someone to write the code for you?
I'm going to become rich when I create a device that allows me to punch people in the face over the internet.
"If an Indian asked a programming question in the forest, would it still be urgent?" - John Simmons / outlaw programmer
|
|
|
|
|
Hi all,
I have a textbox control in my windows form, where user can type the message and insert any picture he wants and export it. If he selects any picture, i am appending the message like "Picture picno Inserted" to the textbox.
Now, my problem is, if he uses backspace key to delete anything in the message, the "Picture inserted" message should not get deleted. Means, that particular string has to be greyed out & disabled in the textbox. So, that i need not get bothered about calculating length for each keypress event.
Could any one please tell me how can I achieve this? Meanwhile, i tried of selecting the text & changing the color of the selected text but didn't get how to disable that particular text... And also i tried of using RichTextBox too but in vain.
Thanks in aDvance,
Durga.
Strength is life, Weakness is death.
--- Swami vivekananda
|
|
|
|
|
You cannot disable part of the text in a textbox. You will have to handle TextChanged yourself.
Cheers,
Vikram.
"I will put my new found knolage to good use" - Captain See Sharp.
"Every time Lotus Notes starts up, somewhere a puppy, a kitten, a lamb, and a baby seal are killed." - Gary Wheeler.
|
|
|
|
|
Create your own class similar to...
public class picno
{
private int _PictureNumber;
public int PictureNumber
{
get { return _PictureNumber; }
set { _PictureNumber = value; }
}
public override string ToString()
{
return "Picture " + _PictureNumber.ToString() + " Inserted";
}
public picno(int PictureNumber)
{
_PictureNumber = PictureNumber;
}
}
then, when a picture is selected, create an instance of this assigning the picture number to the property and update the text. Something like...
picno myPicNo = new picno(25);
textBox1.Tag = myPicNo;
textBox1.Text += textBox1.Text + " " + (picno)textBox1.Tag;
On the text changed event, look to see if the alteration would change any text that matches (picno)textBox1.Tag and disallow if needed.
(You may need to use (picno)textBox1.Tag.ToString() for some operations)
modified on Wednesday, February 06, 2008 6:41:19 AM
|
|
|
|
|
Hey all,
In a lottery system website what are the things to keep in mind?
So far I thought about:
SSL to secure the client/server connection
Login site to authenticate and authorize the people working for the lottery place.
Database to store all the info.
The application itself, which by the way, would it be possible to make this website interface look like a desktop form?
It has to be a website type application because it needs to be OS independent. It has to run in a Unix Computer as well as in a Nintendo DS and everything in between.
Where can i get some c# scripts tutorials/books? I have googled it but I haven't been lucky so far.
I have a solid php/apache/mysql/javascript base but I am like quick sand in asp/IIS/Sql Server. I know the basics of Sql Server but so far it gets frustrating.
But I have learned my lesson you guy taught me, always work with the best and the best tools if you want to be part of the elite.
thanxs all!!!!
PS: this is the random question: which one is better asp or php, IIS or Apache, Javascript or C# scripts or vbscripts, python or c# or VB or Java?
And what is the difference between J# and C# because all examples i see in MSDN look the same to me!
Luis E Tineo S
|
|
|
|
|
Hi,
I am using Windows authentication and I get the current user like this:
AppDomain.CurrentDomain.SetPrincipalPolicy(PrincipalPolicy.WindowsPrincipal);<br />
WindowsPrincipal myPrincipal = (WindowsPrincipal)Thread.CurrentPrincipal;<br />
<br />
Response.Write(myPrincipal.Identity.Name + "<br /><br />");
I get the current groups like this:
foreach (IdentityReference idref in WindowsIdentity.GetCurrent().Groups)<br />
{<br />
Response.Write(idref.Translate(typeof(NTAccount)).Value + "<br />");<br />
Response.Write(idref.Translate(typeof(NTAccount)).Value + "<br />");<br />
}
What I need to find out is if the user belongs to any of these groups. How do I test this?
Please can some one help?
Regards,
Brendan
|
|
|
|
|
hi, I'm having a problem in declaring and passing a value to a public variable in C#.Net. I am a VB.Net user not a C#.Net user, i just thinking if i convert my VB.Net code to C#.Net and that's what I'm doing now.
In VB.Net you can create a Module where you can declare all your public variables to use it again and again. My problem now is, how can i declare a public variable/s in C#.Net so that i can use it for many times and also to pass a value to that variable so that i can get the value i pass to public variable.
Example.
Public strFullName as String , where strFullName is the variable where i pass the FullName of the person who logged to the system.
Thank You.
Don't block the drive way of all the newbies in programming.
|
|
|
|
|
Google not working for you?
class YourClass
{
public string fullName;
}
Having said that, using public variables is a Bad Thing. You should use properties instead.
class YourClass
{
private string _fullName;
public string FullName
{
get { return _fullName; }
set { _fullName = value; }
}
}
Cheers,
Vikram.
"I will put my new found knolage to good use" - Captain See Sharp.
"Every time Lotus Notes starts up, somewhere a puppy, a kitten, a lamb, and a baby seal are killed." - Gary Wheeler.
|
|
|
|
|
what's wrong with this?
code of Class
class getUserName<br />
{<br />
private String _UserName;<br />
<br />
public String UserName<br />
{<br />
get<br />
{<br />
return this._UserName;<br />
}<br />
set<br />
{<br />
this._UserName = value;<br />
}<br />
}<br />
}
code of Button 1 in Form 1
i put the "myUsername" to Username inside the getUsername class so i can get the Username whereever i open a different form.
private void button1_Click(object sender, EventArgs e)<br />
{<br />
getUsername objgetUsername = new getUsername();<br />
<br />
objgetUsername.UserName = "myUsername";<br />
}
code of Button 2 in Form 2
here i will retrieve the myUsername to put it in the Messagebox to show the Username i used.
private void button2_Click(object sender, EventArgs e)<br />
{<br />
getUsername objgetUsername = new getUsername();<br />
<br />
MessageBox.Show(getUsername.UserName);<br />
}
my problem now is, I'm getting a null value in Form 2 Button 2 everytime i click the Button 2. Any help out there.
Thank You.
if(you type your code here) {
Messagebox.Show("You help me a lot!");
}
else {
You help me = null;
}
|
|
|
|
|
Simple - the two objects you create in the two methods are different.
Anyway, this is wrong on so many levels. Your classes should be nouns, not verbs. Also, you don't even need a new class to store the user name in this case. In your form, just declare private string _userName; Then, in your methods, you can read and modify _userName directly.
Cheers,
Vikram.
"I will put my new found knolage to good use" - Captain See Sharp.
"Every time Lotus Notes starts up, somewhere a puppy, a kitten, a lamb, and a baby seal are killed." - Gary Wheeler.
|
|
|
|
|
hi
i open my .mdb file from c# with system.diagonistics.proccess.start()
but i donot know how open it exclusive
i try to send the argument : /excl but it donot open exclusive
please help me
p00932004@yahoo.com
parastoo saadat
|
|
|
|
|
Hello!
You want to open it in MS ACCESS or open for data-access?
In second case, you have to connect to it using MS ACCESS driver/connection string. For connection-string visit ConnectionStrings.com.
Regards,
Adeel
Do rate the reply, if it helps or even if it doesnot, because it helps the members to know, what solved the issue. Thanks.
|
|
|
|
|
hi all
iam having a grid in my application which has 4 columns of which 1 column i set visible=false.i want to bind the value of that column to the textbox.since the bound column is not visible the data is not coming in the textbox.can anyone tell me how to bind the data.
pintoo
|
|
|
|
|
Hi Chithra!
You must have some DataSource to bind a Grid. So directly set that column value to the TextBox.
Suppose you have DataTable as DataSource then try this.
DataTable dt = new DataTable();
if(dt!=null)
{
if(dt.Rows.Count>0)
{
TextBox1.Text = dt.Rows[0][4].ToString();
YourGrid.DataSource = dt;
YourGrid.DataBind();
}
}
I hope this will help you.
Regards..
"Save water,It's precious"
|
|
|
|
|
hi
thanx for the reply.but i have binded the data already.i want to retrieve the data from the gridview but not from the data table directly(data is present in the grid but the visible property is set to false.)i want to retrieve the data from the grid.
pintoo
|
|
|
|
|
Hi Chithra!
Where is your TextBox resides? Inner side or outer side of GridView?
"Save water,It's precious"
|
|
|
|
|
hey
i got it..the text box was outside the grid only..actually i used a html input field and made that field in the grid hidden..iam giving the code here which i used.
and to retrieve the value
txt1.Text = ((HtmlInputHidden)GvPromotion.Rows[e.NewEditIndex].FindControl("DescHiddenValue")).Value;
pintoo
|
|
|
|
|
hey
i got it..the text box was outside the grid only..actually i used a html input field and made that field in the grid hidden..iam giving the code here which i used.
and to retrieve the value
txt1.Text = ((HtmlInputHidden)GvPromotion.Rows[e.NewEditIndex].FindControl("DescHiddenValue")).Value;
anyway thanx for sparing your time..
pintoo
|
|
|
|
|
You are Welcome!......
"Save water,It's precious"
|
|
|
|
|
Hi,
I have developed a Windows Contol and now I want to add multi language support so that my control user (the developer) will be able to create a sattelite assembly and place the assembly to appropriate folder in his application. But I can I convert my control so that it can load string from sattelite assembly, moreover, how can I set the option to my control so that the language can be set or automatically set by the operating system ! 0r by the developer (manually). I searched in Google, but I am not getting any easy direction, all articles are talking about either how to create sattelite assembly or how to set different culture. But my problem is realted to Custom Control where I dont have headache of creating sattelite assemblies, rather I want to give the option to my control user to use sattelite assembly/
Please help.
|
|
|
|
|
I have an input class in my XNA game, and I call a method from that class to the main class, to exit the game.
(Basically)
class Game1 : XNA.blah,blah,blah<br />
{<br />
<br />
Input input;<br />
<br />
void Initialize()<br />
{<br />
input = new Input();<br />
}<br />
<br />
void Update(GameTime gameTime)<br />
{<br />
input.CheckInput();<br />
}<br />
}<br />
<br />
public class Input : Game1<br />
{<br />
public void CheckInput()<br />
{<br />
if (Keyboard.GetState().IsKeyDown(Keys.Escape))<br />
{<br />
this.Exit();<br />
}<br />
}<br />
}
*there's more code, but that's not the issue; regualr stuff it starts with
So, how would I make the game exit from a different class? Thanks.
- I love D-flat!
|
|
|
|
|
public class Game1{
private Input mInput;
public Game1(){
mInput = new Input(this);
}
}
public class Input{
private Game1 mGame;
public void CheckInput(){
mGame.Exit();
}
public Input(Game1 game){
mGame = game;
}
}
Need a C# Consultant? I'm available.
Happiness in intelligent people is the rarest thing I know. -- Ernest Hemingway
|
|
|
|