|
Maybe:
FileStream myFS = new FileStream(filename, FileMode.Open, FileAccess.Read); BinaryReader myBR = new BinaryReader(myFS);
byte[] outData = new byte[myBR.BaseStream.Length];
for (int x = 0; x == myBR.BaseStream.Length; x++)
outData[x] = myBR.ReadByte();
gauthee
|
|
|
|
|
Hi,
(1) Is there any reason why I have to click three times on the dropdown button of a DataGridViewComboBox before the dropdown list actually gets displayed?Is it the Control property that an user needs to click thrice.
(2) We want that the items list should be made visible by clicking it once. And then by next click the item should be selected. Please let us know how to achieve it.
Thanks & Regards,
Rudra
|
|
|
|
|
I have file I want to transfer it from pc to another via modem the problem is I want to make the procedure on one button click. one in the sender side to send the file and another on the receiver side to receive the file.
I think it would be possible to do it depending on hyper terminal but i couldn't find way to run hyper and work on it on c# project ?
if any body can help on this way or another ?
best regards
sam
|
|
|
|
|
Hi
I have a problem with load WSE 3.0 to ma project in Visual Studio 2005 (C#).
I am doing liki in this site: http://dotnetslackers.com/articles/aspnet/GettingStartedCreatingWSEEnabledWebService.aspx
and
http://www.15seconds.com/issue/040603.htm
but when I right click on the asp project I don't have WSE Settings..
" Step 1
Right click on the web service project http://localhost/DocumentLibraryService and select WSE Settings 3.0… from the context menu.
"
I installed WSE3.0 with opiton for Visual Studio Developer and I have it in the start menu, but I don't have in the my project. I must set several option that add to the web.config but how I do it ?
Best regards
difit
I
|
|
|
|
|
How do I make textbox (or label) to have a value, who
is increment for 1, every time when I put some
data in database?
For exaplme, textbox had a value=1!
When I press button, ex: Insert data,
the data are inserted in database, and
textbox then, should have a value 2!
Like a sequence number, I need for
inserting data in database, but I don't user
to enter this, number, instead, the number to
increment it self, when I press button, ex: Insert data,
and, value of that textbox to go in database...
Thank you!
kpp
|
|
|
|
|
KppsK wrote: How do I make textbox (or label) to have a value, who
is increment for 1, every time when I put some
data in database?
For exaplme, textbox had a value=1!
When I press button, ex: Insert data,
the data are inserted in database, and
textbox then, should have a value 2!
Like a sequence number, I need for
inserting data in database, but I don't user
to enter this, number, instead, the number to
increment it self, when I press button, ex: Insert data,
and, value of that textbox to go in database...
You have a counter somewhere. In your button handler for the insert you increment the counter and update the Text property of the TextBox.
|
|
|
|
|
just keep your textbox's enabled property = false...
and in the click function of the button
write this
private void button1_Click(object sender, EventArgs e)
{
int i = int.Parse(textBox1.Text) + 1;
textBox1.Text = i.ToString();
}
Kuldeep
|
|
|
|
|
Well - first of all, the database must support an autoincrement. Then, you need to get this value back. If it's SQL Server, then you are in luck because you can use the Scope_Identity in the same command to retrieve the value just inserted. Ideally, you would do this in a stored procedure. For instance:
CREATE PROCEDURE [dbo].[SaveData]
@ID INT OUT,
@Name NVARCHAR(50)
AS
SET NOCOUNT ON
INSERT INTO MyTable (Name) VALUES (@Name)
SET @ID = Scope_Identity() To retrieve the information, you would use a SQL Command and add the @ID and @Name parameters yourself. The OutputDirection of @ID would be InputOutput, which allows you to retrieve the incremented value from @ID.
Deja View - the feeling that you've seen this post before.
|
|
|
|
|
From a windows application form I need to print a ticket from a special ticket printer. that ticket includes a 2D barcode which is a string of all the information about a customer. I need to encrypt it and get as a byte array so I use Cryptoservices and done that. to concatenate that data with other data I've done something like this
System.Text.ASCIIEncoding enc = new System.Text.ASCIIEncoding();
string str = System.Text.Encoding.ASCII.GetString(b);
So printing part is working fine. But when I scan the barcode and try to get it back to byte array like this,
byte[] b = System.Text.Encoding.ASCII.GetBytes(data);
Then my array size gets smaller and when I try to decrypt it it throws an error saying that invalid length of string.
can anybody help me.
|
|
|
|
|
You can't use ASCII encoding to get the bytes as a string. It only support seven bit character codes, which means that any byte that is between 128 and 255 is replaced by a question mark.
Actually, you shouldn't use any text encoding at all to turn arbitrary bytes into text. Most encodings does't have a character for every possible byte value. Text encodings are used to turn text into bytes and back, not the other way around.
You have to encode the bytes in a different way. You can for example use base64 encoding:
string str = Convert.ToBase64String(b);<br />
<br />
byte[] b = Convert.FromBase64String(str);
---
single minded; short sighted; long gone;
|
|
|
|
|
when I use base64 its working fine. But i want to optimise the space taken by the barcode. I tried hex conversion and that also works fine. and then the size of the barcode is smaller. I want to make it much smaller.
|
|
|
|
|
Base64 puts 6 bits of data in each character, which only gives an overhead of 33%. That's the most compact way that you can easily represent binary data as text.
Hexadeximal representation only puts 4 bits of data in each character, giving an overhead of 50%.
Even if you find some complicated conversion that can squeeze almost 8 bits of data in each character, that is only about 30% better than base64. If you want to make the string substantially shorter, look at what the data represents and see if you can remove any unused parts of it.
---
single minded; short sighted; long gone;
|
|
|
|
|
I have a datatable named EmployeeDT. I am using hastable to store data. I want to to take an employeeID of EmployeeName from data table When i select Employee name in the combobox and add to HashTable.
But i am Binding only EmployeeName.So how can i get Emplyee Id to add to Hash Table?
I am binding data to combobox using this method
foreach(DataRow drow in EmployeeDT.Rows)
{
cboemployee1.Items.Add(drow["Name"].ToString().Replace("\"","\'"));
cboemployee2.Items.Add(drow["Name"].ToString().Replace("\"","\'"));
cboemployee3.Items.Add(drow["Name"].ToString().Replace("\"","\'"));
}
From this code how can i add key to the hash table
|
|
|
|
|
Please don't repost problems so soon after you've posted them before.
I notice that you've been presented with an answer and that you have chosen to ignore this. This site isn't for us to do your work for you.
Deja View - the feeling that you've seen this post before.
|
|
|
|
|
The other thing is, don't use 'Urgent' in the subject line.
God Bless,
Jason
I am not perfect but I try to be better than those before me.
So those who come after me will be better than I am.
|
|
|
|
|
am developing application in ASP.Net with C#. i am using button for FileOpenDialog to browse any image from hard drive as follows
openFileDialog1.ShowDialog();
string s = openFileDialog1.FileName;
textBox6.Text = s;
problem is:
i want the browsed image to be copied in local hosti.e,""C:\\Inetpub\\wwwroot\\15 WebSite\\images\\1.jpg"
i have the follwing idea in mind
File.Copy("C:\\Inetpub\\wwwroot\\15 WebSite\\images\\1.jpg", "C:\\Inetpub\\wwwroot\\15 WebSite\\images\\xyz.jpg");
or
File.Copy(s.Substring(13,s.Length-13), "C:\\Inetpub\\wwwroot\\15 WebSite\\images\\xyz.jpg");
but i dont want to existing image to be overwrite, i want all images to ve saved in local host
can anyone sugesst me what to do?
|
|
|
|
|
If you use File.Copy("C:\\Inetpub\\wwwroot\\15 WebSite\\images\\1.jpg", "C:\\Inetpub\\wwwroot\\15 WebSite\\images\\xyz.jpg");
it will throw IOException if the destination already exists so you should check that before you start copying. What so you want to do if the file already exists? I suggest you give them all unique name using GUID.
|
|
|
|
|
will u plz make ur sugesstion some more clear that "give them all unique name using GUID" GUID?
|
|
|
|
|
He means that the Guid type is guaranteed to generate a unique value, so there is no danger of overwriting files. For instance:
string fileDest = Path.Combine(@"c:\Images\Copy", Guid.NewGuid().ToString() + ".gif");
File.Copy(@"c:\Images\MyImage.gif", fileDest);
Deja View - the feeling that you've seen this post before.
|
|
|
|
|
can u suggest a solution for following problem
public static int count = 0;
private void button3_Click_1(object sender, EventArgs e)
{
openFileDialog1.ShowDialog();
string s = openFileDialog1.FileName;
textBox6.Text = s;
string st = "Pict" + (count++) + ".jpg";
File.Copy(s.Substring(13, s.Length - 13), "C:\\Inetpub\\wwwroot\\15 WebSite\\images\\" + st);}
i want the image to be saved in local host with the same name as as it was present in hard drive (from where it was browsed)
i have applied ur GUID example but unfortunately its not working, can u apply this in my code?
|
|
|
|
|
Use the File.Exists method to check for the presence of a particular file.
Paul
|
|
|
|
|
You can't keep the filenames the same - you are going to have to change them somehow.
The Guid example would be:
string s = System.IO.Path.GetFileName(openFileDialog1.FileName);
string st = "Pict" + Guid.NewGuid().ToString() + ".jpg";
File.Copy(openDialog1.Filename, Path.Combine(@"c:\inetpub\wwwroot\15 website\images", st));
Deja View - the feeling that you've seen this post before.
|
|
|
|
|
string strQuery = "";
openFileDialog1.ShowDialog();
string s = openFileDialog1.FileName;
textBox6.Text = s;
st2 = s;
string st = "Pict" + Guid.NewGuid().ToString() + ".jpg";
File.Copy(openFileDialog1.FileName, Path.Combine(@"c:\inetpub\wwwroot\15 website\images", st));
strQuery = "INSERT INTO criminal(pic_name) VALUES('"+System.IO.Path.GetFileName(openFileDialog1.FileName)+"')";
SqlCommand com = new SqlCommand(strQuery, conn);
com.ExecuteNonQuery();
PROBLEM:
error comes on this the SQL Query , am i inserting rightly?
or there is some other way
Actually i want to insert only picture name of the picture to be browsed
can u plz suggest any solution
|
|
|
|
|
If you get the solution can you please post it on all the forums your posted this question.
"More functions should disregard input values and just return 12. It would make life easier." - comment posted on WTF
"I haven't spoken to my wife now for 48 hours. I don't like to interrupt her.
|
|
|
|
|
can anybody tell me what is the vc++ euivalent of the foloowing c# code
n = strXML.IndexOf("\n", n+1);
string Char = strXML.Substring(Pos, 1);
thanks in advance
Vikas da
vikas da
|
|
|
|