|
I would think that if you google 'datagridview AND printing', you might find something to suit. After all it's highly unlikely that you are the first to want to do this.
Henry Minute
Do not read medical books! You could die of a misprint. - Mark Twain
Girl: (staring) "Why do you need an icy cucumber?"
“I want to report a fraud. The government is lying to us all.”
|
|
|
|
|
Can't believe there is not a quick obvious solution to this, I must be missing something.
I have a winforms app with a tabbed control with textbox controls bound to a dataset table. If the user attempts to leave the tab I want to check for open edits and throw up a save/cancel dialog box if there are.
The problem arises when I need to test for row edit mode.
This:
if (DS.Tables["table_name"].Rows[0].RowState == DataRowState.Modified)
{....}
doesn't reflect any edits until I call endedit on the row, but then the edit is committed and now the user can't go back and cancel the edits.
Is there a way to check edit status on a dataset table row without calling endedit?
|
|
|
|
|
I think you'll find this is event management, pick the one you need from the myriad events possible. I would look for an event when the user enters the edit mode of the cell rather than the datatable state. I would set a manual flag (my favourite is to enable the SAVE button ) and hassle the user if they move off before saving.
There was/is some problems around the tab page change events not firing correctly that may be an issue also.
Never underestimate the power of human stupidity
RAH
|
|
|
|
|
hi to all,
i created the Componentclass using C#.net. I got dll file and i use it in other application it's working fine.But now i want to take this dll to other system as a instalation file(.exe). how i create exe file will put dll into my .net toolbox automatically... How can i do this.. Please help.. Thanks in advance...
Thanks & Regards
R RajaGuru
|
|
|
|
|
you'll using dll filename.
|
|
|
|
|
Create a Setup Project.
Henry Minute
Do not read medical books! You could die of a misprint. - Mark Twain
Girl: (staring) "Why do you need an icy cucumber?"
“I want to report a fraud. The government is lying to us all.”
|
|
|
|
|
Hi All!
I am currently working on some file operations for my application and I want to Read the first line of a text file, grab it in a string, perform some actions, delete that line in the text file, and then do the same thing on the second line, and then the same for every line after that until there are no more lines left. Does anybody have any advice on how to go about this? I'd appreciate any help I can get on this, thanks for reading.
Jay.
j.t.
|
|
|
|
|
I'm afraid there is no direct way to remove a line from the beginning of a file.
The only way you can do this is to overwrite the entire file with all the lines in the original file but the first one.
In case you don't know, you can use File.ReadAllLines and File.WriteAllLines to read and write lines on a file.
|
|
|
|
|
To do this, you have to do something like this:
while(true)
{
StringBuilder wholeText = "";
String fileName = "file.txt";
Textreader tr = new StreamReader(fileName);
String oneLine = tr.ReadLine();
if(oneLine == null)
{
break;
}
else
{
doSomethingWith(oneLine);
}
while(String s = tr.ReadLine != null)
{
wholeText.add(String.Format("{0}\n",s);
}
tr.Close();
Textwriter tw = new StreamWriter(fileName);
tw.write(wholeText.ToString());
tw.Close();
}
This isn't tested, but the methodoligy should work.
|
|
|
|
|
Why would you delete the line? in your scenario, when you are done, the file is empty.
You could as well use File.ReadAllLines as has been said before, but leave the lines where they are and delete the entire file (or just all its content with WriteAllText("") when done. Much easier.
Luc Pattyn [Forum Guidelines] [My Articles]
- before you ask a question here, search CodeProject, then Google
- the quality and detail of your question reflects on the effectiveness of the help you are likely to get
- use the code block button (PRE tags) to preserve formatting when showing multi-line code snippets
|
|
|
|
|
Thank ya'll for your great advice. It's much appreciated. I figured out how to do it Yay!!!!! Here's the code incase anybody's interested.
private void TookMeLongEnough_Click(object sender, EventArgs e)
{
string[] lines = File.ReadAllLines(openFileDialog1.Tag.ToString());
foreach (string line in lines)
{
SaveSessionTextBox.Text = fbd.SelectedPath +
"\\" +
i++ +
"A" +
i++ +
DateTime.Now.Hour +
DateTime.Now.Minute +
DateTime.Now.Second +
DateTime.Now.Millisecond +
".spr";
}
}
foreach( inch on Jason )
{
Girlfriend.IsHappier();
}
|
|
|
|
|
some remarks anyway:
1.
jas0n23 wrote: openFileDialog1.Tag.ToString()
very strange, you use the Tag to hold a filespec?
2.
the hour/minute/sec/msec parts would be nicer with a fixed width, i.e. leading zeroes.
Try DateTime.Now.ToString("HHmmssfff")
3.
not sure why you would want two autoincrements in the filename; I would suggest
s=fbd.SelectedPath + "\\"+ i.ToString("N5")+ "_" + DateTime.Now.ToString("HHmmssfff")+".spr";
i++;
Luc Pattyn [Forum Guidelines] [My Articles]
- before you ask a question here, search CodeProject, then Google
- the quality and detail of your question reflects on the effectiveness of the help you are likely to get
- use the code block button (PRE tags) to preserve formatting when showing multi-line code snippets
|
|
|
|
|
Haha, yeah now that you mention it Luc Pattyn, it is very strange that I use .Tag to hold File Specs. But, it's just a weird preference is all. Is there any reason as to why this may be a bad thing to do?
Regards,
Jay.
foreach( inch on Jason )
{
Girlfriend.IsHappier();
}
|
|
|
|
|
Hi,
I am basically a VC++ developer but now working on C#.
I am having a assembly in that i have added a UserControl and on that UserControl I am having a tree-view control and Property Grid control. As and when user selects the different nodes I am populating the corresponding properties in that grid. For the normal properties its working perfectly. But when I have to choose the property from the drop-down list. Its creating the problem. Whenever I click on the drop-down arrow nothing happens.
So I created a test application. Took a windows form application added property grid, added a class deriving it from StringConverter. Everything works fine in test application. But I don't know why its failing in my production code.
I debugged both codes. In test application whenever I click on the drop-down arrow call is coming inside GetStandardValues function. But this is not happening in my main code, its not hitting the break-point at all.
Can anybody tell me why this is happening, Where I am going wrong?
the test application code is below. The exact code is present in my main code
namespace PropertyPage
{
class MyProperties:StringConverter
{
private double str1;
private string str2;
private string str3;
public override bool GetStandardValuesSupported(ITypeDescriptorContext context)
{
//return base.GetStandardValuesSupported(context);
return true;
}
public override bool GetStandardValuesExclusive(ITypeDescriptorContext context)
{
//return base.GetStandardValuesExclusive(context);
return true;
}
public override StandardValuesCollection GetStandardValues(ITypeDescriptorContext context)
{
return new StandardValuesCollection(new string[] { "Entry1", "Entry2", "Entry3" });
}
[CategoryAttribute("Task "), DescriptionAttribute("test"), TypeConverter(typeof(MyProperties))]
public string Str3
{
get { return str3; }
set { str3 = value; }
}
[CategoryAttribute("Task "), DescriptionAttribute("test"), ReadOnly(true)]
public double Str1
{
get { return str1; }
set { str1 = value; }
}
[Editor(typeof(System.Windows.Forms.Design.FolderNameEditor), typeof(System.Drawing.Design.UITypeEditor))]
public string Str2
{
get { return str2; }
set { str2 = value; }
}
}
}
I am initializing the grid as
private void Form1_Load(object sender, EventArgs e)
{
MyProperties my = new MyProperties();
my.Str1 = 12;
propertyGrid1.SelectedObject = my;
}
I have observed similar behavior with Str2 Property. Its not allowing me to set the path in my main code but in test application its doing its job.
|
|
|
|
|
Hi,
Please help me with your ideas for the following
1.Does .net support for WEBDAV protocol?
2.Can I implement .net remoting using WEBDAV protocol?
Right now I implemented .net remoting using TCP/IP protocol.It is working fine.I need to change this to support the WEBDAV protocol.
Please help me.
|
|
|
|
|
1. There are several third party frameworks bringing webdav-apis for .net
2. ???? AFAIK WebDav is a protocol for file-operations over web. How should this work together with remoting?
3. Please don't crosspost.
Regards
Sebastian
|
|
|
|
|
Hi,
Is it possible to display the items in a combobox in the same way windows does it when you go to open a file. If you start typing text a dropdown is displayed with files that match the text being entered.
|
|
|
|
|
hey ShivarajKumar
it is possible what you are looking for
just look at this link for the same
http://www.vbforums.com/showthread.php?p=3480955
akhilonly007@gmail.com
|
|
|
|
|
You can use AutoCompleteSource property of Combobox class.
|
|
|
|
|
Hello
I have the following code which inserts user text into a GIF image:
this.DestinationImage = new Bitmap(this.SourceImage.Width, this.SourceImage.Height, PixelFormat.Format32bppArgb);
using (Graphics graphics = Graphics.FromImage(this.DestinationImage))
{
//Draw the original image.
graphics.DrawImage(this.SourceImage, 0, 0);
//Used to write smooth text.
graphics.TextRenderingHint = TextRenderingHint.AntiAlias;
//Write the title you want.
graphics.DrawString(title, titleFont, titleBrush, left, top, StringFormat.GenericTypographic);
titleFont).Height;
//graphics.DrawString(body, bodyFont, bodyBrush, left, yTop, StringFormat.GenericTypographic);
//Free the resources.
graphics.Dispose();
}
I need to know how to animate the text (ie.- flash it, change its color, etc.)
|
|
|
|
|
Hi,
your code modifies the destination image, so if you save it with DestinationImage.Save() the file would contain both the original image and the text written on top of it; however your code does not show anything, so how could it flash?
if you want to see some animation effects on screen, you should make sure everything gets painted;
one way to do it would be to have a PictureBox that shows the original image, then use its Paint event to draw something on top of it. If you install a Windows.Forms.Timer to periodically invalidate the PB, your Paint handler would be called again and could paint something slightly different to get the animation effects you want.
Luc Pattyn [Forum Guidelines] [My Articles]
- before you ask a question here, search CodeProject, then Google
- the quality and detail of your question reflects on the effectiveness of the help you are likely to get
- use the code block button (PRE tags) to preserve formatting when showing multi-line code snippets
|
|
|
|
|
Can any one please tell me how to compress a dataset and decompress it without getting a out of memory error.
Thanks in advance!
|
|
|
|
|
|
I don't want to compress the file on the hdd it must be on in the memory
|
|
|
|
|
Then you have to use a MemoryStream instead of a FileStream.
|
|
|
|