|
As far as I am aware, there is no property to put text beside the checkbox - the text goes into the column heading where it it less intrusive for the user. If you really must do this, you will probably have to create your own custom control, based on a DataGridViewCheckBoxCell, and incorporate the text yourself. I haven't tried this, so I have no idea what problems you are going to face.
Are you sure you need it, given that you can only have true / false / grey in the checkbox anyway?If Barbie is so popular, why do you have to buy her friends?
Eagles may soar, but weasels don't get sucked into jet engines.
If at first you don't succeed, destroy all evidence that you tried.
|
|
|
|
|
Thanks you for your reply
I will have to derive a class from DataGridViewCheckBoxCell
Thanks
|
|
|
|
|
Hi all,
I'm sure that this has been asked quite a bit but I can not find a answer to it. I know that I have seen C# prototypes like in C/C++ .h/.cpp files but can not remember how it is done. In the several searches I have done the closest I can come to are partial classes. Is this the right direction? If so what is the proper syntax for declaring them? I like to have the decelerations in a separate file/location so I don't have to search through lines of code just to get to the functions decelerations.
Thanks for the help!!!!
-Andy
|
|
|
|
|
I could be wrong, but I don't think C# has prototypes in the same way as C or C++ - the only ones I can think of are for abstract members or interfaces. If Barbie is so popular, why do you have to buy her friends?
Eagles may soar, but weasels don't get sucked into jet engines.
If at first you don't succeed, destroy all evidence that you tried.
|
|
|
|
|
Thanks!
I know that I had seen this done in a Article Source File but don't remember how it was done. If this is not a "Best Practice" what is? I am new to C#
Thanks again ...
-Andy
|
|
|
|
|
The only thing I can think of that even comes close to a "prototype" would be a delegate definition.
|
|
|
|
|
Now why did you get downvoted.. still that stupid guy from yesterday/some days back/whatever?
|
|
|
|
|
There's some wierd univoting going on around here Fived to compensate as well as for a good answer!
|
|
|
|
|
C# does not use prototypes; class definition information is culled from the object files where it is stored as metadata. Take a look through MSDN for more information on the C# language and compiler. MVP 2010 - are they mad?
|
|
|
|
|
Hello there!
I have an Xdocument created programatically, and i wan't to zip it and save it in a gzip file.
Now my problem is that i want the name of the zip file, to be independent from the name of the zipped file...
i.e the zip file will be foo.gz, and the file inside will be test.xml. Now i have read that
by using -GZipStream- you can't actually give a name to your file. i have managed to zip files, but not name them... any ideas?
Here is how i do it at the moment
private void Compress(XDocument doc, string fullUserFilePath)
{
byte[] buffer;
MemoryStream memoryStream = new MemoryStream();
XmlWriter writer = XmlWriter.Create(memoryStream);
doc.Save(writer);
writer.Close();
memoryStream.Position = 0;
buffer = new byte[memoryStream.Length];
memoryStream.Read(buffer, 0, buffer.Count());
using (FileStream outfile = new FileStream(fullUserFilePath, FileMode.Create, FileAccess.Write))
{
using (GZipStream stream = new GZipStream(outfile, CompressionMode.Compress))
{
using (BinaryWriter sw = new BinaryWriter(stream))
{
sw.Write(buffer);
}
}
}
}
|
|
|
|
|
What is the value of fullUserFilePath? Surely that will determine the name of the zip file Life goes very fast. Tomorrow, today is already yesterday.
|
|
|
|
|
yes that is the name of the zip file, but it names the file within it like that, whereas i want to name it differently.
so at the line:
using (GZipStream stream = new GZipStream(outfile, CompressionMode.Compress))
it would be ideal if i could do something like:
using (GZipStream stream = new GZipStream(outfile,"myfileName.xml", CompressionMode.Compress))
but that's not possible ...
|
|
|
|
|
I see what you mean, what if you rename the zipped file? you can use System.IO.File.Move(...) for that. Life goes very fast. Tomorrow, today is already yesterday.
|
|
|
|
|
the problem is that after compression, i want to rename the zipped file(within the zip file...)
the name of the zip file is correct...
|
|
|
|
|
So do it the other way around, make the name of the gzipped file correct and change the filename of the result
|
|
|
|
|
Like harold says, do it the other way around.
You may want to consider creating a 'temp' zip file named the same as you want the internal file to be called. Then you the File.Move function to move that 'temp' file to that specified in fullUserFilePath
Just remember to be careful where you create temp files, Application.Startup (or similar) can cause write issues with certain user restrictions. Maybe 'ApplicationData' or something like that would be fine. Your choice thouLife goes very fast. Tomorrow, today is already yesterday.
modified on Monday, February 8, 2010 1:20 PM
|
|
|
|
|
Or you could use SharpZipLib[^], it's free and places no restrictions on your license if you link with the binary. The compression ratio is better and it allows you to properly handle and create zip files (the problem you have does not occur with SharpZipLib)
|
|
|
|
|
Friends,
I hope you can help me. I am developing a new project and this project I have several screens. Well, I would like to create a screen through her name and that name is the same class name of the screen.
Example:
I create a new screen, and put her name as formCadastro. Now, in my base form, I would go to a function the string value "formCadastro" function and open the screen with the same name.
Is it possible? I tried to work a little with the System.Windows.Forms.Form class but I could not ... Thank you for your help.
Success for All
|
|
|
|
|
Like this[^] ?
I know the language. I've read a book. - _Madmatt
|
|
|
|
|
Friend, it would be nearly so. But I wanted something simpler. There is to create a container of the screens?
I am studying the example. Thanks
|
|
|
|
|
Have you tried a switch statement?
switch(inputname){
case "Screen1": Screen1 s1 = new Screen1();
s1.ShowDialog();
break;
case "Screen2": Screen2 s2 = new Screen2();
s2.ShowDialog();
break;
default:
break;
} V.
|
|
|
|
|
Friend, this will not work.
There are many screens, and would like to develop a generic method.
Thanks!
|
|
|
|
|
I would use something like this...
private void CreateScreen(string FullName, params object[] args)
{
Type t ;
Form f;
t = Type.GetType(FullName);
if (t != null) {
f = Activator.CreateInstance(t, args) as Form;
if (f != null) {
f.Show();
}
}
}
This would also allow you to pass arguments to the constructor. You may also have to pass the Full name of the Form including the Namespace. I don't remember how Type.GetType() works.
Edit: Sorry, forgot I was in C#.modified on Monday, February 8, 2010 11:02 AM
|
|
|
|
|
Perfect! Thanks Brother
Sucess!
|
|
|
|
|
Hi,
I have got a serious problem. I have connect a table with the windows form. The table looks like
Id name age place country
1 sss 11 ttt qqq
2 ww 12 eee qqq
Now I'm able to display all of them in a richtextbox in the following format whose country = qqq
1.
Id ="1"
Name = "sss"
age =11
place = "ttt"
country = "qqq"
2.
Id ="2"
Name = "ww"
age =12
place = "eee"
country = "qqq"
now i add a linklabel control to the textbox. the text of the linklabel wiill be the result of Name column when on click it is linked to a webpage.
here my problem is it is not scrolling along with text.
this is how my code looks :
public void button3_Click(object sender, EventArgs e)
{
OdbcCommand bcC2 = new OdbcCommand();
bcC2.CommandText = "select * from C_RefCitation where c_id like ('" + textBox5.Text + "')";
bcC2.Connection = OdbcCon;
DataSet q3 = new DataSet();
OdbcDataAdapter db1A2 = new OdbcDataAdapter(bcC2);
db1A2.Fill(q3);
dataGridView1.DataSource = q3.Tables[0];
richTextBox2.Visible = true;
richTextBox2.Clear();
for (int x = 0; x < dataGridView1.Rows.Count - 1; x++)
{
richTextBox2.AppendText((x + 1).ToString() + ". ");
for (int y = 0; y < dataGridView1.Columns.Count; y++)
{
richTextBox2.AppendText("\n");
richTextBox2.AppendText(dataGridView1.Columns[y].HeaderText);
richTextBox2.AppendText(" : ");
if (dataGridView1.Columns[y].HeaderText.ToString() == "c_CitationDOI")
{
this.richTextBox2.SelectionStart = this.richTextBox2.TextLength;
int index = richTextBox2.Text.Length;
Point position = richTextBox2.GetPositionFromCharIndex(index);
LinkLabel label = new System.Windows.Forms.LinkLabel();
RichTextBox sri = new System.Windows.Forms.RichTextBox();
label.Text = dataGridView1.Rows[x].Cells[y].Value.ToString();
label.AutoSize = true;
label.Location = new Point(0,position.Y);
label.LinkBehavior = LinkBehavior.NeverUnderline;
richTextBox2.Controls.Add(label);
richTextBox2.AppendText(label.Text);
label.Links.Add(1, 7, dataGridView1.Rows[x].Cells[y].Value.ToString());
label.LinkClicked += new System.Windows.Forms.LinkLabelLinkClickedEventHandler(this.label_LinkClicked);
}
else
{
richTextBox2.AppendText(dataGridView1.Rows[x].Cells[y].Value.ToString());
}
if (y != dataGridView1.Columns.Count - 1)
{
richTextBox2.AppendText(", ");
}
}
richTextBox2.AppendText("\n\n\n ");
}
}
please help me in modifying this code so that the controls scroll along with text box.
Thank you very much
|
|
|
|