|
maysam gamini wrote: If you do more attention
If you would go back and read your original post, no where in the post is any reference to any C# code that you have tried to address your database problem. I paid very careful attention.
In any case you might try this C# Image to Byte Array and Byte Array to Image Converter Class[^]
Why is common sense not common?
Never argue with an idiot. They will drag you down to their level where they are an expert.
Sometimes it takes a lot of work to be lazy
Individuality is fine, as long as we do it together - F. Burns
Help humanity, join the CodeProject grid computing team here
|
|
|
|
|
THank you Wes Aday,
i use this :
public Image ByteToImageConvert(byte[] byteArrayIn)
{
MemoryStream ms = new MemoryStream(byteArrayIn);
Image returnImage = Image.FromStream(ms);
return returnImage;
}
private void button2_Click(object sender, EventArgs e)
{
string strData = dataGridView1[2, 0].Value.ToString();
byte[] data = Convert.FromBase64String(strData);
pictureBox1.Image = ByteToImageConvert(data);
}
but i face with this problem on " Image returnImage = Image.FromStream(ms);":
Parameter is not valid.
What should i do?
PLease HELP!
thank you!
|
|
|
|
|
I wouldn't be too sure that the string is encoded in base 64 unless you know for sure that it is. Would be unusual to my way of thinking. I am thinking that the MemoryStream is the invalid parameter because the byte array is invalid.
maysam gamini wrote: string strData = dataGridView1[2, 0].Value.ToString();
try something like:
byte [] data = new ASCIIEncoding().GetBytes(strData);
MemoryStream ms = new MemoryStream(data);
Image im = new Image.FromStream(ms);
Why is common sense not common?
Never argue with an idiot. They will drag you down to their level where they are an expert.
Sometimes it takes a lot of work to be lazy
Individuality is fine, as long as we do it together - F. Burns
Help humanity, join the CodeProject grid computing team here
|
|
|
|
|
Thank you,
but unfortunately i sill have he same problem as before.
Parameters is not valid!
private void button2_Click(object sender, EventArgs e)
{
string strData = dataGridView1[2, 0].Value.ToString();
byte[] data = new ASCIIEncoding().GetBytes(strData);
MemoryStream ms = new MemoryStream(data);
Image im;
im = Image.FromStream(ms);
pictureBox1.Image = im;
}
|
|
|
|
|
Sorry
Like Richard said. There are 2 things that I can think of:
1. It's not really a valid image stream. That is, the data is not an image but something else.
2. The data string is encrypted.
BTW I think that you will have a hard finding someone that will take your database and just open it up. Especially from an unknown source. *I* won't do it.
Good luck.
Why is common sense not common?
Never argue with an idiot. They will drag you down to their level where they are an expert.
Sometimes it takes a lot of work to be lazy
Individuality is fine, as long as we do it together - F. Burns
Help humanity, join the CodeProject grid computing team here
|
|
|
|
|
Dear Friends,
Well i found that, it's definitely a String Base 64, 'cause I was able to build a byte array from it with this code:
string strData = dataGridView1[2, 0].Value.ToString();
byte[] data = Convert.FromBase64String(strData);
and i use this :
public Image ByteToImageConvert(byte[] byteArrayIn)
{
MemoryStream ms = new MemoryStream(byteArrayIn);
Image returnImage = Image.FromStream(ms);
return returnImage;
}
but i face with this problem on " Image returnImage = Image.FromStream(ms);":
Parameter is not valid.
What should i do?
PLease HELP!
thank you!
modified on Thursday, November 5, 2009 6:55 PM
|
|
|
|
|
maysam gamini wrote: Parameter is not valid.
I think this message is telling you that the stream is not a valid image stream. It does not matter how you create the stream, unless it is a valid image it will not convert. You need to check the format of correct image streams and then compare to your data to see what the differences are.
|
|
|
|
|
thank YOu!
Guys, I attached the Database File and all information that i have, please just try, and find a soloution for me.
tnx!
i probably know what the problem is, but i don't know how could i handle it!
|
|
|
|
|
maysam gamini wrote: Guys, I attached the Database File and all information that i have, please just try, and find a soloution for me.
I don't have the time or the expertise to do this; I am sorry but the problem is yours to resolve. People here will help where they can but if you need a full solution you will probably have to pay someone for it.
|
|
|
|
|
|
Good afternoon. I have the following code:
private void cboFolder_SelectedIndexChanged(object sender, EventArgs e)
{
if (cboFolder.SelectedValue != null)
{
Cursor.Current = Cursors.WaitCursor;
SetProgressBarMarquee();
lblLoading.Visible = true;
progressBar1.Visible = true;
this.viewToolStripMenuItem.Enabled = true;
cboSP_Site.SelectedIndex = -1;
cboWS.SelectedIndex = -1;
txtAddress.Text = cboFolder.SelectedValue.ToString();
WebBrowser1.Focus();
WebBrowser1.Url = new Uri(cboFolder.SelectedValue.ToString());
SendKeys.Send("+{F10}(VD)");
}
}
private void SetProgressBarMarquee()
{
this.progressBar1.Style = ProgressBarStyle.Marquee;
this.progressBar1.MarqueeAnimationSpeed = 50;
}
When I select one of the items in the combo box the folders display in detail format, but others do not. On the second selection for example temp folder it displays as details.
Any suggestions? WHEELS
|
|
|
|
|
I have this little code who is adding that number to a listbox1, already make in the UI.
What I want is to RENAME the listbox1 to lb, BUT inside this void ONLY.(I think of it as a some sort of variable when I want to rename it.)
HOW TO DO IT?
public void ListBoxItemAdd()
{
listBox1.Items.Add("12345");
}
Thanks
~Teodor~
|
|
|
|
|
public void ListBoxItemAdd()
{
ListBox lb = listBox1;
lb.Items.Add("12345");
} Is this that you want to achieve? But this is not renaming, you can't rename a variable inside a code block.
|
|
|
|
|
merlinq12 wrote: BUT inside this void ONLY
This seems to be a pointless thig to do as it gains you nothing. Can you explain more what you are trying to achieve by this?
|
|
|
|
|
Hi dear all,
Can anyone realize multi level pie chart (3 level) in .net (winform or wpf)?
Please refer to this link for sample: http://www.fusioncharts.com/pcdocs/Contents/Images/MLPie1.jpg
Pleeasee!
|
|
|
|
|
b3t1m0s wrote: Can anyone realize multi level pie chart (3 level) in .net (winform or wpf)?
what do you mean by Word "realize"?
Have you looked into commercial control such as Dundas Chart for .NET?
|
|
|
|
|
I have a .NET PropertyGrid that (amongst other things) display a property with the validation rule:
[IntegerValidator(MinValue = 1, MaxValue = 5)]
If the user attempts to set it to a value outside the range then I would expect a "Properties Window" dialog with the message "Property value is not valid" and a Details button that allows the dialog to be expanded to display the message:
"The value for the property 'XXXX' is not valid. The error is: The value must be inside the range 1-5."
Occasionally though I just get an exception that is caught at the top level by my application (which then terminates).
Any ideas why this should happen? (It does seem to happen when, on leaving the cell, the user immediately scrolls the grid - but not always.)
"...there's what people want to hear, there's what people want to believe, there's everything else, THEN there's the truth!" - New York D.A., The International
|
|
|
|
|
Is this Grid a external control (in Dll)?
Wags wrote: Occasionally though I just get an exception that is caught at the top level by my application (which then terminates).
I presume is that refers to class (program.cs) where main form gets to be run? Or Just a from place where it was assigned that value to the control.
Have you tried updating your .Net Framework? Have you Looked in MSDN?
|
|
|
|
|
I hadn't noticed that the PropertyValueChanged event was being handled.
"...there's what people want to hear, there's what people want to believe, there's everything else, THEN there's the truth!" - New York D.A., The International
|
|
|
|
|
I've got a class which connects to server. Then the server sends to client at some specific time intervals data.
I've got a problem in recieving that data if single read is less than the whole data to be transfered
e.g. 10K is going to be sent. I BeginRead with 1024 buffer as in TcpClientData class with all public fields.
These are the 2 functions from the class
class MyClient
{
private void ConnectButtonClick(object sender, EventArgs e)
{
TcpClient tcpClient = new TcpClient();
tcpClient.Connect(ipAddress, port);
NetworkStream ns = tcpClient.GetStream();
TcpClientData cd = new TcpClientData();
cd.tcpClient = tcpClient;
cd.ms = new MemoryStream;
cd.packet = new byte[1024];
ns.BeginRead(cd.packet, 0, cd.packet.Length, new AsyncCallback(TcpClientDataReadAsyncCallback), cd);
}
private void TcpClientDataReadAsyncCallback(IAsyncResult ar)
{
TcpClientData cd = (TcpClientData)ar.AsyncState;
NetworkStream ns = cd.tcpClient.GetStream();
int sz = cd.ns.EndRead(ar);
cd.ms.Write(cd.packet, 0, sz);
while (ns.DataAvailable == true)
ns.BeginRead(cd.packet, 0, cd.packet.Length, new AsyncCallback(TcpClientDataReadAsyncCallback), cd);
cd.ms.SetLength(0);
cd.ns.BeginRead(cd.packet, 0, cd.packet.Length, new AsyncCallback(TcpClientDataReadAsyncCallback), cd);
}
}
What is wrong?
Чесноков
|
|
|
|
|
I suspect the problem is with this bit:
while (ns.DataAvailable == true)
ns.BeginRead(cd.packet, 0, cd.packet.Length, new AsyncCallback(TcpClientDataReadAsyncCallback), cd); It's recursively (kinda) calling itself who knows how many times in the middle of its processing. That might have been intended to be a synchronous read instead of an asynchronous one. If you want to rely solely on asynchronous comms then the read callback function might need a little redesign.
|
|
|
|
|
I do not know if you answer was correct but when I changed to:
if (ns.DataAvailable == true)
{
ns.BeginRead(cd.packet, 0, cd.packet.Length, new AsyncCallback(TcpClientDataReadAsyncCallback), cd);
return;
}
It worked.
The async data recieving is that kinda of recursive approach
Чесноков
|
|
|
|
|
Hello,
I m creating a C# .NET Project in which i m trying to load third party Assemblies which are installed in GAC.
But in some machines I m getting an error stating "Unable to Load assembly of specified version 7.0.351.0".
when i tried to do an assembly redirection it didn't work it still shows the same error.
Note:
7.0.351.0 - Is the version with which it is compiled.
12.0.0.0 - Assembly present in the Target machine
Properties of Reference
Specific Version -> False
Aliases -> global
Copy Local -> False
This is my sample application configuration file
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<runtime>
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1" >
<dependentAssembly>
<assemblyIdentity
name="Act.Framework"
publicKeyToken="ebf6b2ff4d0a08aa" />
<bindingRedirect oldVersion="7.0.351.0"
newVersion="12.0.0.0" />
</dependentAssembly>
</assemblyBinding>
</runtime>
</configuration>
I have not placed the assemblies in application path, I just want it to redirect to the version present in the GAC(12.0.0.0).
How do I Proceed with this?
Thanks in Advance.
|
|
|
|
|
You will get this error if any dependent assemblies can't found also. Make sure everything is in place.
I know the language. I've read a book. - _Madmatt
|
|
|
|
|
a
modified 23-Nov-14 7:20am.
|
|
|
|