|
My first idea was to use WriteAllBytes, but books did not talk about it. And the online resources did not show me properly how to code it. I found the other solution which i used, but I am getting garbage. Can you please show me how to make it work?
|
|
|
|
|
It should work without special effort. Did you verify that the bytes you give it are OK?
|
|
|
|
|
computerpublic wrote: You keep saying you don't know what I am trying to do. I think it is pretty obvious that ...
Of course it's obvious to you - you're the one who's having the problems. The trick is to clearly explain the problem to someone else, remembering that we can't see your screen, access your hard-drive, or read your mind.
None of the questions you've posted in the last couple of days have had a clear explanation of what you're trying to do. They've mostly been code-dumps with a few cryptic comments along the lines of "this line doesn't work". The code you've posted doesn't seem to make any logical sense, because you haven't explained what you're trying to do.
The code you posted in this question is almost identical to the code you posted in the question below[^]. It seems you either didn't read Pete's answer, or you didn't understand it, because now you're just calling a random method and trying to assign the result to an incompatible type. Reposting a virtually identical question whilst ignoring the previous answers is not a good way to get people to help you!
"These people looked deep within my soul and assigned me a number based on the order in which I joined."
- Homer
|
|
|
|
|
<pre>
using System;
using System.IO;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace Applica
{
class Program
{
static void Main(string[] args)
{
long Totbyte = 0;
string filePath = null;
DirectoryInfo da = new DirectoryInfo("C:\\Folder");
FileInfo[] Arr = da.GetFiles();
foreach (FileInfo ap in Arr)
{
Totbyte = ap.Length;
filePath = ap.FullName;
}
string temPath = Path.GetTempFileName();
byte[] data = new byte[Totbyte];
if (File.Exists(temPath))
{
data = File.ReadAllBytes(filePath);
File.WriteAllBytes(temPath, data);
}
int[] arry = new int[Totbyte]; for (int count = 0; count < data.Length; count++)
{
arry[count] = Convert.ToDecimal(BitConverter.ToInt(data,count));
}
}
}
}
|
|
|
|
|
You have created arry as a byte array of integers and you are trying to stuff a decimal value into it. There's no need to do Convert.ToDecimal on the output of BitConverter (and it should be ToInt32 - not ToInt).
|
|
|
|
|
I was expected a byte value to be no larger than 255, but I am now getting values 10 digits long. Please kindly explain what is going on.
|
|
|
|
|
The issue you are hitting is because you are misusing BitConverter[^]. If you just want to convert a byte to an int, then you can simply assign the values across if you want to because a byte will upcast into an int quite happily. There's no need to do a conversion in this case.
|
|
|
|
|
Hi All,
We Develop a financial system which is a desktop c# application and we need to add a functionality that allow to pay by the visa cards, my question is what I should have to develop this functionality and what is the best 3rd party to use, and is the 3rd party should have an API's to use it in my Application.
Please help me ASAP because I'm a new in this.
Thanks for your efforts.
|
|
|
|
|
never done this, but my initial idea would be to get a hold on the party responsible of payment.
Usually payments go through a TRUSTED third party provider. In Belgium we have "Ogone" for example. Your application forwards payment details to this company who will ask the user for credit card details. Then the provider, when payment is approved redirects the user back to you and will notify you if payment was done or not.
So first thing to do is get in contact with such a provider.
Hope this helps.
|
|
|
|
|
V is absolutely right - go with a reliable card transaction service company.
And this is really, really important:
Never, ever, accept code from a insecure website to handle anything to do with real money.
You do not know who is giving you the code, you do not know what it does, you do not know that it places the monies correctly into the appropriate account, without passing the details to any third parties.
Only get such code from reputable card transaction service companies - the scope for fraud otherwise is far too large. And remember, you personally could be liable for any monies lost if your action is seen to be negligent - which getting your code from a public forum would most certainly be!
Which means: Don't ask here - always go back to them for assistance. Don't worry about looking stupid or lacking in knowledge: it's a lot, lot better than looking at a prison cell...
Those who fail to learn history are doomed to repeat it. --- George Santayana (December 16, 1863 – September 26, 1952)
Those who fail to clear history are doomed to explain it. --- OriginalGriff (February 24, 1959 – ∞)
|
|
|
|
|
Too bad we can only click the UpVote button once.
|
|
|
|
|
You can create multiple account to UpVote...
Thanks
-Amit Gajjar
|
|
|
|
|
Yeah, I'm not into having socket puppets.
|
|
|
|
|
OriginalGriff wrote: V is absolutely right
I should print this in large curly letters and frame it
|
|
|
|
|
I recommend that you do not use paypal.
I was scammed by someone buying a key to my software then telling paypal the transaction was a fraud - they got to keep the key and were refunded.
So due to this terrible service from paypal I now broadcast this negative experience far and wide
“That which can be asserted without evidence, can be dismissed without evidence.”
― Christopher Hitchens
|
|
|
|
|
Hey Guys,
I need your assistance, am struck up with an issue.
Issue: I have retrived a SQL data into a DataGridView, It has the below column header names like (Package_ID, Package_Name etc.)
I used the below code to copy the data in DataGridview to Excel.
Copying is fine, but am not getting the colum headers which are visible in my DatagridView. (Package_ID, Package_Name etc.)
Other than the Column headers all other data are getting copied.
the code i used:
private void copyAlltoClipboard()
{
dataGridView1.SelectAll();
DataObject dataObj = dataGridView1.GetClipboardContent();
if (dataObj != null)
Clipboard.SetDataObject(dataObj);
}
private void btn_Export_Click(object sender, EventArgs e)
{
copyAlltoClipboard();
Microsoft.Office.Interop.Excel.Application xlexcel;
Microsoft.Office.Interop.Excel.Workbook xlWorkBook;
Microsoft.Office.Interop.Excel.Worksheet xlWorkSheet;
object misValue = System.Reflection.Missing.Value;
xlexcel = new Excel.Application();
xlexcel.Visible = true;
xlWorkBook = xlexcel.Workbooks.Add(misValue);
xlWorkSheet = (Excel.Worksheet)xlWorkBook.Worksheets.get_Item(1);
Excel.Range CR = (Excel.Range)xlWorkSheet.Cells[1, 1];
CR.Select();
xlWorkSheet.PasteSpecial(CR, Type.Missing, Type.Missing, Type.Missing, Type.Missing, Type.Missing, true);
}
i want my column headers also need to be copied to Excel.
Please assist.
|
|
|
|
|
Mohan Subramani wrote: i want my column headers also need to be copied to Excel. The headers aren't "data"; if you copy the data to Excel, then that's what get's copied. You could loop through the columns before exporting and write those to the first row.
Bastard Programmer from Hell
If you can't read my code, try converting it here[^]
|
|
|
|
|
|
hello,i wanna create a software with c# that i will use datagridview,and will use LINQ,how can i fetch data from database in to datagridview that when scroll into down data one by one fetch from database? please help me!!!
|
|
|
|
|
If you fetch a record when the user scrolls down, scrolling will become painfully slow. It'd be executing a query for each row that becomes visible.
If you want something faster than data-binding look into Virtual Mode[^].
Bastard Programmer from Hell
If you can't read my code, try converting it here[^]
|
|
|
|
|
hello,i wanna create a software that i will use datagridview,and will use LINQ,how can i fetch data from database in to datagridview that when scroll into down data one by one fetch from database? please help me!!!
|
|
|
|
|
How to create Help Provider?
|
|
|
|
|
Google, amazing tool, if you use it...
If I feed it your whole question: Google "How to create Help Provider"[^] it gives me over 700 million hits...
Number two on this list is MSDN: Introduction to the Windows Forms HelpProvider Component[^]
In future, please try to do at least basic research yourself, and not waste your time or ours.
Those who fail to learn history are doomed to repeat it. --- George Santayana (December 16, 1863 – September 26, 1952)
Those who fail to clear history are doomed to explain it. --- OriginalGriff (February 24, 1959 – ∞)
|
|
|
|
|
What is the purpose of a .edmx file? It is a XML formatted file in Visual Studio. It has database table information. But how is it used in a Visual Studio C# asp.net web app?
Online search engines say that "an .edmx file is an XML file that defines a conceptual model, a storage model, and the mapping between these models. An .edmx file also contains information that is used by the ADO.NET Entity Data Model Designer (Entity Designer) to render a model graphically."
But how is it used, and how is it made?
|
|
|
|
|