|
hi freind can any body tell me that how i can create addin for Outlook 2002 in VS2005 if yest then how
wasim khan
|
|
|
|
|
Hi all,
I want to store the contents changes of my windows controls in a database. Therefore I determined the name of the object in the control_enter_method and save the name and value as string. Later in the case of canceling the changes I want to reassign the stored values from database back to the controls.
How can I reference the control object by it's name (stored as string) ?
My idea was
object obj;
((TextBox)obj).Name = stored_obj_name;
((TextBox)obj).Text = stored_value;
but this does not work.
what's to do ?
Tnx in advance
Frank
|
|
|
|
|
If you control name, you can access Controls property of a Form class using an indexer that takes string as an input.
Giorgi Dalakishvili
#region signature
my articles
#endregion
|
|
|
|
|
just to put an example with Giorgi's reply
this.Controls["textBox1"].Text = "Hello World";
|
|
|
|
|
Hi Giorgi,
thanks for the reply.
Is that the right solution to get the index ?
I tried this
int index = this.Controls.IndexOf((TextBox)sender);
but get always index = -1;
Where is my fault ?
Tnx Frank
|
|
|
|
|
int index = this.Controls.IndexOf(textBox1);
works for me, where is your code, what is the sender?
int index = this.Controls.IndexOf(null);
gives me -1, so it sounds like you are not passing in a textbox that is in the Controls collection
|
|
|
|
|
The sender comes from the Textbox control enter method
The Enter_Control method is in the Form class where also the Textbox exists.
private void Enter_Control(object sender, System.EventArgs e)
{
try
{
switch(sender.GetType().ToString())
{
case ("System.Windows.Forms.TextBox"):
int index = this.Controls.IndexOf((TextBox)sender);
this.Controls[index].BackColor= Color.Blue;
break;
}
}
catch{}
}
Tnx
Frank
|
|
|
|
|
You can do it like this:
private void Enter_Control(object sender, System.EventArgs e)
{
if (sender is TextBox)
{
((TextBox)sender).BackColor = Color.Blue;
}
}
Giorgi Dalakishvili
#region signature
my articles
#endregion
|
|
|
|
|
Hi Giorgi,
I had to break the discussion yesterday ...
My code should only test that I have got the right index of the selected control and set the backcolor in this "long way" as test that it works. But the problem already exists, that I don't get an index != -1. This is main funcion of my method
int index = this.Controls.IndexOf((TextBox)sender);
tnx Frank
|
|
|
|
|
Is the textbox on the form itself or is it on the panel or groupbbox or any other container? If yes, then instead of this.Controls you should have the container that contains your textbox.
Giorgi Dalakishvili
#region signature
my articles
#endregion
|
|
|
|
|
Oh yes,
that's the problem.
Due to the hierarchical structure of my Form each control is a container of controls. I tested my method and it works, for one container, but it doesn't help me with the problem.
my intention was to reference a control by its name (as a string) independant of the location of the control. But the index is not unique and the prerequisite is the known of the hierarchical structure of my form. Changing the form would change the indices.
Isn't there an other way ?
txn Frank
|
|
|
|
|
Hi guys,
at the moment I try to migrate a very very simple VS2005 web service example to VS2008. In my scenario I only call a service with two parameters so get the sum of both. In VS2005 it is working like this
C#-Code:
proxy.Credentials = new NetworkCredential (txtUsername.Text, txtPassword.Text);
Double result = proxy.ZAdd(1, 2);
But I cannot use this code in VS2008.
Do you have any solution to pass simple http Authentification credentials?
I appreciate any comment!
|
|
|
|
|
Has nobody a possible answer?
|
|
|
|
|
Hi all
I want to write a C# program that will run in the background and listen to any Interaction with the printer and write to log files.
Please help by providing a source that can help me learn how to detect if the printer is printer?
Thank you
Mosd
Be what you want to be
modified on Tuesday, August 19, 2008 6:50 AM
|
|
|
|
|
Hallo.
Either I am a noob, or something strange is going on .
I have got an ASP.net webform , on this form I have a object datasource ( which is linked to my class).
When I add a form view to the form and link it to my object datasource the template is not generated for me. I need to manually build the template. It is if the formview does not see the objectdatasources select,insert etc commands. The class I am linking to, does work.
please help, i think somewhere I am missing a property or something.
kind regards
J0hn 0 C0nn3 r
|
|
|
|
|
Try the ASP.NEt forum...
Christian Graus
No longer a Microsoft MVP, but still happy to answer your questions.
|
|
|
|
|
Something weird was not wrong it was the latter. I tried to bind a list of objects to formview, and apparantly this is not possible...
he he
|
|
|
|
|
hi all,
i want to use " Registory on Target machine " option using vs.net 2005 (c# windows)in Setup and deployment while setup file creation,and how can i put keys and string values,how to use this option ,please explain it.
Thanks &Regards,
vishnu.
|
|
|
|
|
Hi,
I am new to this forum and also to the C# and .Net environment.
I am exporting the data grid to the excel sheet,but the problem is the reports are displayed twice in the excel sheet i am not getting where the error might be...pls can sm one help me out.
Thanks
Annu
|
|
|
|
|
Sorry, I've left my psychic head at home.
How can anyone help without seeing your code?
Bob
Ashfield Consultants Ltd
|
|
|
|
|
Hello here is my code...
protected void LinkButton1_Click(object sender, EventArgs e)
{
Response.Clear();
Response.ContentType = "application/ms-excel";
Response.AddHeader("content-disposition", "attachment;filename=Daily.xls");
Response.Charset = "";
System.IO.StringWriter sw = new System.IO.StringWriter();
HtmlTextWriter hw = new HtmlTextWriter(sw);
tb.RenderControl(hw);
Response.Write(sw.ToString());
Response.End();
}
public override void VerifyRenderingInServerForm(Control Control)
{
return;
}
|
|
|
|
|
Is there any error in my code..???
|
|
|
|
|
GridView gwTemp = new GridView();
gwTemp.Datasource = dtData; // assign the data from your gridview object
Response.Clear();
Response.Buffer = true;
Response.ClearContent();
Response.ClearHeaders();
Response.ContentType = "application/vnd.ms-excel";
Response.AddHeader("Content-Disposition", "attachment;filename=HelpDesk_Report.xls");
Response.Charset = "";
this.EnableViewState = false;
System.IO.StringWriter sw = new System.IO.StringWriter();
System.Web.UI.HtmlTextWriter htw = new HtmlTextWriter(sw);
gwTemp.RenderControl(htw);
Response.Write(sw.ToString());
Response.End();
|
|
|
|
|
Hi,Here is my code its i think almost similar..
protected void LinkButton1_Click(object sender, EventArgs e)
{
Response.Clear();
Response.ContentType = "application/ms-excel";
Response.AddHeader("content-disposition", "attachment;filename=Daily.xls");
Response.Charset = "";
System.IO.StringWriter sw = new System.IO.StringWriter();
HtmlTextWriter hw = new HtmlTextWriter(sw);
tb.RenderControl(hw);
Response.Write(sw.ToString());
Response.End();
}
public override void VerifyRenderingInServerForm(Control Control)
{
return;
}
I am displaying my grid view first in a web page and on click of a link its being exported..to excel
|
|
|
|
|
Hi.
Im using Bitmap to Draw the graphs using GDI+ objects, every time while loading the new graph the "PF usage" (memory size) keeps adding by 20 or even more.. how to destroy the current instance of a GDI+ object used to draw a graph or how to re-use the same Bitmap to draw new graph keeping the memory size constant.
please help me out ni this asap.
regards
vinayskvs
|
|
|
|