|
That's not too pretty. Better use System.Text.Encoding.ASCII.GetString()
Standards are great! Everybody should have one!
|
|
|
|
|
Thanks Martin
|
|
|
|
|
hi
i want my datagridVIEW rows has periodic color
for example :
row No color
0 white
1 blue
2 white
3 blue
. .
. .
. .
what can i do?
|
|
|
|
|
Example:
this.dataGridView1.Rows.Add("1");
this.dataGridView1.Rows[0].DefaultCellStyle.BackColor = Color.Blue;
this.dataGridView1.Rows.Add("2");
this.dataGridView1.Rows[1].DefaultCellStyle.BackColor = Color.Red;
|
|
|
|
|
In my application, I want to change the appearance of the tab (not the tab page itself) (i.e. font of Tab text, background of the tab etc.).
I know I need to set the draw mode property of the tab control to owner mode and handle the drawitem event. But drawitem event fires at the time when tabs are drawn. Once my application is up and running I'm not drawing the tab. Can any one pls let me know how i can change the appearance of the tab at runtime?
e.g. I have got one button on my tab page and if I click that button the back color of tab should change.
thanks,
|
|
|
|
|
Hello,
KrunalC wrote: I know I need to set the draw mode property of the tab control to owner mode and handle the drawitem event.
You should stay at this solution.
At the button click, you could use the TabControl.Refresh() method. This will redraw the TabControl and it's TabPages.
All the best,
Martin
|
|
|
|
|
Thanks for the reply.
Problem was because of my false understanding. I was under impression that tab of the page is part of tabpage and not the tabcontrol. so I was updating the tabpage in draw item rather than tab control. With the tab control update things are working.
|
|
|
|
|
Oh,
Good work!
All the best,
Martin
|
|
|
|
|
Hi
When I type turkish letters(Ğİö..) in a text box and try to pull data, it returns no row..
But when I type select command to SQL Enterprise manager and try to pull same data, it works...
My SQL command is "select * from myTable where (column1='Ğİ' COLLATE Turkish_CI_AI)
I make,
System.Threading.Thread.CurrentThread.CurrentCulture= new System.Globalization.CultureInfo("tr-TR");
in program init...
I put Language setting to form and Localizable=true
This problem only occurs on windows 2000 english, I have no problem with windows XP turkish
I hope I could explain my problem...
Thanks
|
|
|
|
|
i want to create a setup and deployemt project which creates three empty folder. and then i need the path or i say i want to access this path from my windows services. how can i do this???
|
|
|
|
|
To establish a connection from an aspx page to a word document stored in D drive.Then replace few words in document by words present in textboxes in aspx pages
Sowmya
|
|
|
|
|
Required for what? Homework assignment?
What is the point of your post? Have you encountered any problems writing this code? Do you have any specific questions?
---
It's amazing to see how much work some people will go through just to avoid a little bit of work.
|
|
|
|
|
u shud use word interop and word application object.
|
|
|
|
|
I am new to codeproject, and relatively new to C#. Eventually i got bored of... non-saving uses... and decided i needed to save something. So i tried.
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using System.IO;
namespace FileMaker
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
private void btnCreate_Click(object sender, EventArgs e)
{
Stream myStream;
SaveFileDialog saveFileDialog1 = new SaveFileDialog();
saveFileDialog1.Filter = "txt files (*.txt)|*.txt|All files (*.*)|*.*";
saveFileDialog1.FilterIndex = 1;
saveFileDialog1.RestoreDirectory = true;
if (saveFileDialog1.ShowDialog() == DialogResult.OK)
{
if ((myStream = saveFileDialog1.OpenFile()) != null)
{
StreamWriter wText = new StreamWriter(myStream);
wText.Write("CHEESE");
myStream.Close();
}
}
}
}
}
It doesn't work. When i run the program and click on the button, and go through the save file dialog, a file does appear, but "CHEESE" does not appear in the text file. I cannot figure out why this doesn't work. So how do i fix this so that "CHEESE" appears in the file?
Thanks to anybody who helps!
|
|
|
|
|
try closing the streamwriter before closing the stream...
Luc Pattyn
|
|
|
|
|
wText.Close();
MyStream.Close();
unless u close the writer, buffered things will not be explicitly fwded to the disk.
|
|
|
|
|
Hello,
I have created a list of items within a combo box control and would like to use the word "Other" at the bottom of the list to enable a textbox control. Currently I can get the textbox to enable by selecting any list item in the combo box, but unfortunately the textbox enables regardless of what item I choose. I just want the item "Other" to enable it and nothing else.
I can't seem to find anything within MSDN or the net that explains how to do this, and i've seen many applications that use "Other" to enbable a textbox so I know that it can be done.
can someone help?
Thanks!!
|
|
|
|
|
use a Combobox.SelectedIndexChanged event handler that contains
myTextBox.Enabled=myComboBox.SelectedIndex==otherIndex;
Luc Pattyn
|
|
|
|
|
Hi,
Not exist a special function or property. You have to do it manually adding the item "Other" to the list of items and asign it a special value. Then, in the "SelectedIndexChanged" event of the combo box check if the new selected index is the same that the "Other"...
|
|
|
|
|
Hi,
I haven't found an easy way out of a problem I have. I have a class which I would like to initialize from different sources - such as a DataRow, an IDataReader etc. Something similar to:
class MyClass<br />
{<br />
public void Load( DataRow row )<br />
{<br />
m_strName = row["Name"];<br />
m_strTitle = row["Title"];<br />
}<br />
<br />
public void Load( IDataReader reader )<br />
{<br />
m_strName = row["Name"];<br />
m_strTitle = row["Title"];<br />
}<br />
}
You will notice that the code inside these functions is identical. However, I haven't found a way to refactor this code into one common function, since both snippets rely on the indexing feature supported both by DataRow and IDataReader, but I cannot figure out if this could be refactored into a common function (DataRow and IDataReader have no common base classes or interfaces, except System.Object of course).
Has anyone a solution to this? I really hate duplicating code!
Wenn ist das Nunstück git und Slotermeyer? Ja! Beierhund das oder die Flipperwaldt gersput!
|
|
|
|
|
You might try something like this code; Note that this is code that I haven't tested at all though:
public void Load (DataRow row )
{
Load((object)row);
}
private void Load(Object x)
{
m_strName = DataBinder.GetPropertyValue(x, "Name", null);
m_strTitle = DataBinder.GetPropertyValue(x, "Title", null);
}
|
|
|
|
|
Hi,
I can de/serialize objects of a class called Bookings.cs
Had a System.Drawing.Rectangle obj with an [XmlIgnore] in this class
and it ignored it
Later on I decided not to have rectangles displayed in
my windows form because I had to set event handling to them.
So I thought that I could use a flatted Button instead that resembles
a rectangle but also has event methods.
But I wanted a custom control so I extended the Button class.
These MyButton objects are created dynamically and I also declared this MyButton
obj with the [XmlIgnore], just replacing the System.Drawing.Rectangle obj with
MyButton myBut and instantiated it in the constructor of Booking.cs
During run-time i get a reflection error trying to create the XmlSerializer object with typeof(Booking[]) ??
Have googled it all day but cannot seem to understand the problem?
Is it because it is a inherited class this error shows up?
Seeking knowledge, Daniel...
|
|
|
|
|
I am trying to query an AD residing on a different server and came across a snippet. The following line caught my attention:
DirectoryEntry objEntry = new DirectoryEntry("LDAP://DCName/OU=testOU,DC=x,DC=y,DC=z,DC=COM","username","password",AuthenticationTypes.Secure);
Is there a way around hard coding the "username" and "password"? The last three parameters, are they even necessary for creating the DirectoryEntry instance?
Thanks
|
|
|
|
|
The only thing that is 'required' is the server path. The others would be optional parameters as far as I know. This is how I'm querying our AD server (keep in mind however if you're trying to modify anything in the entry, then it will require proper permissions to do so). I needed to query AD based on the samAccountName of a user. I am in NO way an expert, but this worked for me:
string uName;
uName = Environment.UserName;
DirectoryEntry entry = new DirectoryEntry("LDAP://SERVERNAME.SOMEPLACE.COM");
DirectorySearcher mySearcher = new DirectorySearcher(entry);
mySearcher.Filter = ("(samAccountName= " + uName + ")");
Hope that helps for you. Best of luck.
Chris Potter
|
|
|
|
|
Thanks a lot for your response Chris, but suppose you are running your application using localhost while the AD hierarchy is set up in a remote machine in the network under a different domain, in that case would the additional parameters help? My querying AD using .NET concepts are a bit flaky and would really like to understand more.
Thanks...
|
|
|
|