|
For anyone else who wants to achieve this, the FreeImage project provides support for a large number of image codecs and colour modes and has bindings for C#. It is what I used to create a PNG8 file.
Steve
|
|
|
|
|
I'm hoping someone can help me here ...
I have a project that is working well connecting to an Access database file, making queries etc. I discovered that one of the fields in the database is of the wrong type (it is Int32, i want it Text).
- I changed the field type in the database (via Designer View in Access)
- I changed the field type in DataSet in my project (DatabaseDataSet.xsd)
- I changed the data type in the .Add routine.
However, when I compile, the tableadapter .Update command complains about not being able to convert String to Int32. I can't find what else needs to be changed!
Any ideas please ?
Andy
|
|
|
|
|
God I hate MS adapters. Destroy the adapter and rebuild it on the changed table.
The problem with the adapters is the dev who knows nothing else has no idea how they work and therefore when something goes wrong gets stuck with nowhere to go. Recommendation - do some research into a decent Data Access Layer (DAL) there are lots of samples out there and if you are serious about being a dev you need to be able to build one! Sorry rant over.
Never underestimate the power of human stupidity
RAH
|
|
|
|
|
I had this code working yesterday. Today I get "Attempted to read or write protected memory. This is often an indication that other memory is corrupt."
Here's the code. It errors on the oSheet.SaveAs line:
Microsoft.Office.Interop.Excel.Application oXL;
Microsoft.Office.Interop.Excel._Workbook oWB;
Microsoft.Office.Interop.Excel._Worksheet oSheet;
oXL = new Microsoft.Office.Interop.Excel.Application();
oWB = (Microsoft.Office.Interop.Excel._Workbook)(oXL.Workbooks.Add(Missing.Value));
oSheet = (Microsoft.Office.Interop.Excel._Worksheet)oWB.ActiveSheet;
Reader = new StreamReader(ExportParams.sSourceFileName);
iRow = 0;
sSourceRow = Reader.ReadLine();
while (sSourceRow != null)
{
iRow++;
string[] aWords = sSourceRow.Split(',');
oSheet.Cells[iRow, 1] = aWords[0];
oSheet.Cells[iRow, 2] = aWords[1];
oSheet.Cells[iRow, 3] = aWords[2];
sSourceRow = Reader.ReadLine();
}
Reader.Close();
if (File.Exists(ExportParams.sResultFileName))
{
File.Delete(ExportParams.sResultFileName);
}
oSheet.SaveAs(ExportParams.sResultFileName,
Type.Missing,
Type.Missing,
Type.Missing,
Type.Missing,
Type.Missing,
Type.Missing,
Type.Missing,
Type.Missing,
Type.Missing);
oXL.Quit();
Everything makes sense in someone's mind
|
|
|
|
|
Hi ,
can anyone tell how to find the system memory using c#.net 3.5 windows application?
Thanks In Advance.
--Naren
|
|
|
|
|
|
Hi,
use the Ex versions, otherwise you will be in trouble when more than 2GB is present:
[DllImport("kernel32.dll")]
public static extern void GlobalMemoryStatusEx(ref MEMORYSTATUSEX ms);
public struct MEMORYSTATUSEX {
public int Length;
public int MemoryLoad;
public long TotalPhys;
public long AvailPhys;
public long TotalPageFile;
public long AvailPageFile;
public long TotalVirtual;
public long AvailVirtual;
public long AvailExtendedVirtual;
}
modified on Monday, April 20, 2009 2:29 PM
|
|
|
|
|
Hi,
I am trying to include a compression mechanism in my application. I just went through the one that microsoft provides : GZipStream class... I used the sample code given in msdn and tried to compress files... It worked well for text and document files... But when i tried to compress an exe file, say 100mb size, the compressed file that i get is of size more than 130mb... Can anyone please tell me whether this is a problem with the GZipStream Class?
Thanks in advance,
ramz_g
|
|
|
|
|
Hi,
First: Is more easy to compress text files than .exe,
Second: From msdn: http://msdn.microsoft.com/en-us/library/system.io.compression.gzipstream.aspx[^]
The compression functionality in DeflateStream and GZipStream is exposed as a stream. Data is read in on a byte-by-byte basis, so it is not possible to perform multiple passes to determine the best method for compressing entire files or large blocks of data. The DeflateStream and GZipStream classes are best used on uncompressed sources of data. If the source data is already compressed, using these classes may actually increase the size of the stream.
So I think in some way maybe the .exe is already compressed.
|
|
|
|
|
Hi Rolcr,
Thanks for the reply. And yes, I could understand that using those classes to compress files that are already compressed may increase the size. But there is something interesting. I downloaded the gzip.exe from GNU's website and used it to compress a few files. I could find that the size of an exe file reduced by about 5mb... Whereas, using the above classes, the size of the same file increased by more than 30mb. Also, both (gzip.exe and the GZipStream class) returned similar results when applied to .txt and .doc files. Please give me your opinion on this.
Thanks,
ramz_g
|
|
|
|
|
|
Hi Rolcr,
Ya.. Even i browsed through all these sites earlier today and found that there are some issues with GZipStream... Anyways, thanks for the replies...
ramz_g
|
|
|
|
|
Hi
I'm using TableAdapterManager to update relational data. when i insert a master row then insert some child rows and then press update, the following exception occure on UpdateAll method :
Concurrency violation: the UpdateCommand affected 0 of the expected 1 records
i know solution of this problem is handle BindingSource.AddingNew event of child table, if i using BindingSource (see this link: http://msdn.microsoft.com/en-us/library/bb384432.aspx[^]), but i don't use BindingSource and my problem is that how to solve this issue without BindingSource ?
Thanks
|
|
|
|
|
I have a type ahead textbox and on each key press I post back to the server. while the textbox is waiting for the results I would like to display a spinner icon next to the text in the textbox. this spinner icon would indicate that the textbox is waiting for the results.
I have looked at various properties of the text box and couldn’t any property which would allow me to do that.
any suggestions would be appreciated..
thanks,
kar
|
|
|
|
|
I would recommend you look at the AJAX tool kit and use an update panel with an update progress control and respond to the textbox.textchanged event. You may have to set auto postback to true on it as well. This article may help for the AJAX peice.
The UpdateProgress Control of ASP.NET AJAX Extensions[^]
Hope this helps.
|
|
|
|
|
Thanks for the info.. The Text box i wam working on is Winforms textbox. Is there a similar thing that works in a Winforms environment..
Thanks
kar
|
|
|
|
|
Oh I thought you were using ASP.NET since you were sending back to server (what I get for assuming)... You can still respond to the TextBox.TextChanged event. This fires after any input into the textbox. You can use an animated gif to put into an image control to be visible while you are performing whatever operation during the event and set it to visible = false when your processing is complete.
private void currencyTextBox_TextChanged(object sender, EventArgs e)
{
imageProgress.Visible = true;
Application.DoEvents();
...
imageProgress.Visible = false;
Application.DoEvents();
}
You may have an issue with setting the visiblilty in the current thread... the Application.DoEvents() may solve that, but may not, you may need to look at doing the proccessing on a different thread, you could use a backgroundworker for doing that and it is fairly easy to implement.
Hope this helps.
|
|
|
|
|
This one helps.. but the imagecontrol is seperate from the textbox. In my scenario the image control is inside the textbox.
more specifically on the right most side of the textbox where its spinning while waiting for the results to come back..
Could u let me know how I could tie up the image control inside the textbox.
Thanks,
kar
|
|
|
|
|
try using your own user control that contains textbox and image control,
add event begin and end progress to trigger visibility of your image control
hope it helps
dhaim
ing ngarso sung tulodho, ing madyo mangun karso, tut wuri handayani. "Ki Hajar Dewantoro"
in the front line gave a lead, in the middle line build goodwill, in the behind give power support
|
|
|
|
|
You could do something like this. Not perfect or complete but should be a start.
using System;
using System.ComponentModel;
using System.Drawing;
using System.Windows.Forms;
public class BusyTextBox : TextBox
{
private Image busyImage;
private bool isBusy;
public Image BusyImage
{
get { return busyImage; }
set { busyImage = value; }
}
[DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden),
Browsable(false)]
public bool IsBusy
{
get { return isBusy; }
private set
{
isBusy = value;
if (value)
{
using (Graphics g = this.CreateGraphics())
{
}
}
else
{
Invalidate();
}
}
}
protected override void OnTextChanged(EventArgs e)
{
IsBusy = true;
base.OnTextChanged(e);
IsBusy = false;
}
} Make sure you dispose of the busyImage if not null when the BusyTextBox is disposed!
DaveBTW, in software, hope and pray is not a viable strategy. (Luc Pattyn) Visual Basic is not used by normal people so we're not covering it here. (Uncyclopedia) Why are you using VB6? Do you hate yourself? (Christian Graus)
|
|
|
|
|
You mean something like the ErrorControl? You might be able to wrangle that functionality to do what you want.
Codemonkeys don't do it at all. Too busy coding.
|
|
|
|
|
|
wth cd
"WPF has many lovers. It's a veritable porn star!" - Josh Smith As Braveheart once said, "You can take our freedom but you'll never take our Hobnobs!" - Martin Hughes.
My blog | My articles | MoXAML PowerToys | Onyx
|
|
|
|
|
code it, build it, ship it!
|
|
|
|
|
Errrhmmmm ... I don't think I see Testing in there!
10110011001111101010101000001000001101001010001010100000100000101000001000111100010110001011001011
|
|
|
|