|
Hi everybody,
Is it necessary to install Microsoft Office to add reference office.dll in a c# project. Please help me. I can't find the office.dll in the add reference window. I am not installed office in my machine.
Regards,
Rathish P S
|
|
|
|
|
yes, of course.
|
|
|
|
|
Hi ,
How can we do that ?
|
|
|
|
|
Hello,
i'd like to use a combobox with auto-completion like the one used by internet explorer to browse. How can i do that? Of course i'd like to add any items inside, like "Boat, "Car", "Moto", etc....
Thanks a lot
|
|
|
|
|
You need to implement the IAutoComplete2 interface,
Have a look here[^] for an example in c#
|
|
|
|
|
send mail to me and i will send my own autocomplete combobox dll.
ozturk_ferhat@hotmail.com
|
|
|
|
|
Sample c#
<br />
private void ACCombo_KeyUp(ComboBox cbo, KeyEventArgs e)<br />
{<br />
switch(e.KeyCode)<br />
{<br />
case Keys.Back:<br />
case Keys.Left:<br />
case Keys.Right:<br />
case Keys.Up:<br />
case Keys.Delete:<br />
case Keys.Down:<br />
return;<br />
}<br />
<br />
string strTypedText = cbo.Text;<br />
int intFoundIdx = cbo.FindString(strTypedText);<br />
<br />
if(intFoundIdx >= 0)<br />
{<br />
object objFoundItem = cbo.Items[intFoundIdx];<br />
<br />
string strFoundText = cbo.GetItemText(objFoundItem);<br />
<br />
string strAppendText = strFoundText.Substring(strTypedText.Length);<br />
cbo.Text = strTypedText + strAppendText;<br />
<br />
cbo.SelectionStart = strTypedText.Length;<br />
cbo.SelectionLength = strAppendText.Length;<br />
}<br />
}<br />
<br />
private void ACCombo_Leave(ComboBox cbo)<br />
{<br />
int intFoundIdx = cbo.FindStringExact(cbo.Text);<br />
cbo.SelectedIndex = intFoundIdx;<br />
}<br />
Let me know if you need this for VB.NET
I reject to reality and subsitute my own!
- Adam Savage, Mythbuster
life is like a roll of toilet paper. The closer it gets to the end, the faster it goes.
|
|
|
|
|
Thank you so much jklucker
exactly what i wanted
|
|
|
|
|
how to bind a richtextbox control's rtf property to the database??
I convert it to byte array and pass it on in a stream as a byte array and then call
Loadfile method of RichTextBox and pass the stream.
but it says that the specified file is not in a correct format
can u please suggest
using System;
using System.Drawing;
using System.Collections;
using System.ComponentModel;
using System.Windows.Forms;
using System.Data;
using System.Data.SqlClient;
using System.IO;
using System.Text;
namespace deleteit1
{
public class richtextbox : System.Windows.Forms.Form
{
private System.Windows.Forms.Button button1;
private System.Windows.Forms.RichTextBox richTextBox2;
private deleteit1.Dataset1 dataset11;
private System.Windows.Forms.ComboBox comboBox1;
private System.ComponentModel.IContainer components;
public richtextbox()
{
InitializeComponent();
}
[STAThread]
static void Main()
{
Application.Run(new richtextbox());
}
protected override void Dispose( bool disposing )
{
if( disposing )
{
if(components != null)
{
components.Dispose();
}
}
base.Dispose( disposing );
}
#region Windows Form Designer generated code
///
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
///
private void InitializeComponent()
{
this.button1 = new System.Windows.Forms.Button();
this.richTextBox2 = new System.Windows.Forms.RichTextBox();
this.dataset11 = new deleteit1.Dataset1();
this.comboBox1 = new System.Windows.Forms.ComboBox();
((System.ComponentModel.ISupportInitialize)(this.dataset11)).BeginInit();
this.SuspendLayout();
//
// button1
//
this.button1.Location = new System.Drawing.Point(552, 368);
this.button1.Name = "button1";
this.button1.TabIndex = 1;
this.button1.Text = "button1";
this.button1.Click += new System.EventHandler(this.button1_Click);
//
// richTextBox2
//
this.richTextBox2.Location = new System.Drawing.Point(16, 8);
this.richTextBox2.Name = "richTextBox2";
this.richTextBox2.Size = new System.Drawing.Size(624, 336);
this.richTextBox2.TabIndex = 2;
this.richTextBox2.Text = "richTextBox2";
this.richTextBox2.TextChanged += new System.EventHandler(this.richTextBox2_TextChanged);
//
// dataset11
//
this.dataset11.DataSetName = "Dataset1";
this.dataset11.Locale = new System.Globalization.CultureInfo("en-US");
//
// comboBox1
//
this.comboBox1.Location = new System.Drawing.Point(32, 368);
this.comboBox1.Name = "comboBox1";
this.comboBox1.Size = new System.Drawing.Size(320, 21);
this.comboBox1.Sorted = true;
this.comboBox1.TabIndex = 3;
this.comboBox1.Text = "comboBox1";
//
// richtextbox
//
this.AutoScaleBaseSize = new System.Drawing.Size(5, 13);
this.ClientSize = new System.Drawing.Size(680, 430);
this.Controls.Add(this.comboBox1);
this.Controls.Add(this.richTextBox2);
this.Controls.Add(this.button1);
this.Name = "richtextbox";
this.Text = "richtextbox";
this.Load += new System.EventHandler(this.richtextbox_Load);
((System.ComponentModel.ISupportInitialize)(this.dataset11)).EndInit();
this.ResumeLayout(false);
}
#endregion
SqlConnection con = new SqlConnection();
private void richtextbox_Load(object sender, System.EventArgs e)
{
con.ConnectionString = @"data source = DEVELOPMENT;user id = SHC;password = SHC;initial catalog = SHC";
if(con.State == 0)
{
con.Open();
}
try
{
string st;
st = "select * from deleteit";
SqlDataAdapter ad = new SqlDataAdapter(st,con);
ad.Fill(dataset11,0,0,"deleteit");
char[] chardata = new char[1000];
DataTable dt = dataset11.Tables[0];
ArrayList arr = new ArrayList();
//byte[] binaryData = new byte[1000];
//Encoder e1 = Encoding.UTF8.GetEncoder();
Encoding encode = Encoding.UTF8;
if(dt.Rows.Count>0)
{
foreach(DataRow row in dt.Rows)
{
// Convert the string into a byte[].
byte[] binaryData = encode.GetBytes(row["rtf"].ToString());
comboBox1.Items.Add(row["rtf"]);
comboBox1.SelectedIndex = 0;
//MessageBox.Show("binary data length = "+binaryData.Length.ToString());
arr.AddRange(binaryData);
}
}
else
{
MessageBox.Show("no rows");
}
byte[] bytearr = new byte[arr.Count];
arr.CopyTo(bytearr);
MessageBox.Show("byte array copied from arraylist="+ bytearr.GetType());
ASCIIEncoding encoding = new ASCIIEncoding();
richTextBox2.Rtf = encoding.GetString(bytearr);//,0,bytearr.Length);
System.IO.MemoryStream stream = new System.IO.MemoryStream((byte[])bytearr);
richTextBox2.LoadFile(stream,RichTextBoxStreamType.RichText);
}
catch(Exception ex)
{
MessageBox.Show(ex.Message.ToString());
MessageBox.Show(ex.StackTrace.ToString());
}
}
}
}
table name->deleteit
fields-->rollno(numeric),rtf(text)
|
|
|
|
|
I want to create an Archive Mail Reader in C#. With this one can view their mails. No options for editing, deleting or forwarding will be there. Can anyone give an idea about how it can be implemented using C#.
|
|
|
|
|
I have a javascript that creates a dynamic drop down with a person's name as the name is typed. Once the user clicks on the name from the dropdown the page reloads with that person's information in the pages web control's. This part works wonderfully. What doesn't work is when I try to manually edit the text boxes with new values. When I click on my Edit button the text boxes pick up on the intial values and not the new values that were put in the text box. Any ideas why?
|
|
|
|
|
Make sure you don't rebind the data on postback:
Page_Load:<br />
<br />
if(!IsPostBack){<br />
BindData();<br />
}
if you rebind the data here, your changed values will not appear
|
|
|
|
|
I'm trying to get these two methods to modify a value stored within the namespace Interface_Resources and the class TrafficCalculations. I am trying to get them to call two new methods called TrafficLimitIncrement (for UpButton) and TrafficLimitDecrement (for DownButton). How can I do this? I'm in a mental block atm and it's driving me nuts!
Cheers for any help.
[edit]I should probably mention that the Interface_Resources is a dll file being used by a form (which is using the methods UpButton and DownButton) to change a value.[/edit]
|
|
|
|
|
|
hii all .
i need to browse the web from a windows application , just like web application .
using link control or button how can i navigate to a web site or emailing and contacting some on .
thanx alot
لا اله الا الله محمد رسول الله
|
|
|
|
|
Use shellexecute. Or, I believe there's a static 'Process' class kicking around in the runtime that lets you do the same thing without interop.
Christian Graus - Microsoft MVP - C++
|
|
|
|
|
You could try adding a WebBrowser control on ur Windows' form. It will give u all the necessary functions for simulating a Web Browser, along with its behaviour.
Hope this helps
Regards,
Polis
Can you practice what you teach?
|
|
|
|
|
I have a propertygrid, I set its property SelectedObject to the object I want. It displays all the properties. Is there a way to make it display only the properties I want? And how to apply the chenges after the user clicks, let's say Apply button?
|
|
|
|
|
You need to apply attributes to your properties,
I beleive the attribute: BrowsableAttribute will determine whether it gets displayed or not.
As for applying the changes, I assume you have both get and set'ers in your code?
|
|
|
|
|
Is there a way to make it display only the properties I want?
You'll need to implement ICustomTypeDescriptor and return the properties you want displayed in the GetProperties method. These articles (Customized display of collection data in a PropertyGrid[^], Globalized property grid[^], Bending the .NET PropertyGrid to Your Will[^]) show how to do this.
And how to apply the chenges after the user clicks, let's say Apply button?
The best way would probably be to create a new class that contains the properties to be displayed and also implements ICustomTypeDescriptor which you can then select into the property grid instead of the other class. Then when the Apply button is clicked you can copy the new values back.
"I think I speak on behalf of everyone here when I say huh?" - Buffy
|
|
|
|
|
Could you give me the simplest example how to do it? I can't cope with it, I'm new to C#
|
|
|
|
|
My outlook bar contains number of icons and names for those each icon. If Iright click my mouse button then I can rename the text in the icon name. I want to disable this option. Any ideas?
rajitha_kba
|
|
|
|
|
Is this siutable for C# ?
|
|
|
|
|
Ok i am re-asking the question ,probably i wasn`t clear enough to get the attention of people like Heath Stewart
i am working on a add-on Application which would be crawler like,means there would be an entry point URL(e.g: http://site.com/virtual/index.asp),the links from the page will be retrieved and then same process will be repeated with those links,during this exercise,i found relative link on a webpage,for instance "members/file.asp" etc
sine in next round,i have to access the above mentioned URL via HTTPWEbrequest,for that i would have to pass url something like http://site.com/virtual/members/file.asp,where bold part is the part has to be attached with the resultant Url,in html,web browser can understand relative paths, for instance,browser will convert the relative url "../my.asp" to http://site.com/my.asp when its rendered on browser,how could it be done if its done on a non web based application in C#
Thanks
MyBlogs
http://weblogs.com.pk/kadnan
|
|
|
|
|