|
I would just write a Windows Service that pulls in the page periodicaly and scrapes the data I want.
|
|
|
|
|
Hi,
I am trying to validate a excel sheet with student details using a c# code.
If there are any invalid cell found during validation I have to display it in the response.
I tried to add this all to a string and then display it in a label and the output was
Invalid Roll no: 1 Invalid Name:#@#$@#T^$ Invalid Roll no: 2 Invalid Email:2342345345345
The following is how it should be displayed
Invalid Roll no: 1
Invalid Name:#@#$@#T^$
Invalid Roll no: 2
Invalid Email:2342345345345
I got to do this for nearly 100 rows
Friends, Please let me know if you have any Ideas. I don't worry about the scrolls.
|
|
|
|
|
Oops forgot to say this is ASP.NET web page. And the validation should be done on click of a button.
|
|
|
|
|
I think you just need to add a newline constant to the end of each value (not title) you add. The constant is Environment.NewLine
As a side point, you shouldn't really be using a string if you're continually adding values - it's not very efficient. You'd be better using a System.Text.StringBuilder.
HTH
It definitely isn't definatley
|
|
|
|
|
this is a c# class file to encrypt/decrypt
a string when i am using this code in asp.net i am getting an error saying "an error occured in oaep padding" so plz guys help me to get out of this error
using System;
using System.Collections.Generic;
using System.Text;
using System.Security.Cryptography;
using System.IO;
using System.Collections;
namespace Cryptography
{
public class AsymmetricCryptography
{
// Fields
private string pk;
private string prk;
// Methods
public AsymmetricCryptography()
{
RSACryptoServiceProvider provider = new RSACryptoServiceProvider(0x400);
this.prk = provider.ToXmlString(true);
this.pk = provider.ToXmlString(false);
}
public static string Decript(string Decript_Text, string Private_Key)
{
string str = Decript_Text;
string str2 = "";
string xmlString = Private_Key;
RSACryptoServiceProvider provider = new RSACryptoServiceProvider();
// RSAParameters parameters = new RSAParameters();
provider.FromXmlString(xmlString);
string str4 = "";
Queue queue = new Queue();
while (str.Length != 0)
{
if (provider.KeySize == 0x400)
{
str4 = str.Substring(0, str.IndexOf("=") + 1);
queue.Enqueue(str4);
str = str.Remove(0, str4.Length);
}
else
{
str4 = str.Substring(0, str.IndexOf("==") + 2);
queue.Enqueue(str4);
str = str.Remove(0, str4.Length);
}
}
queue.TrimToSize();
int count = queue.Count;
for (int i = 1; i <= count; i++)
{
str4 = (string)queue.Dequeue();
str2 = str2 + Encoding.ASCII.GetString(provider.Decrypt(Convert.FromBase64String(str4), true));
}
return str2;
}
public static string Encript(string Plain_Text, string Public_Key)
{
string str = Plain_Text;
string xmlString = Public_Key;
string str3 = "";
RSACryptoServiceProvider provider = new RSACryptoServiceProvider();
//RSAParameters parameters = new RSAParameters();
provider.FromXmlString(xmlString);
int num = (str.Length / 0x20) + 1;
char[] chars = str.ToCharArray();
byte[][] bufferArray = new byte[num][];
int index = 0;
for (int i = 1; i <= num; i++)
{
if (i == num)
{
bufferArray[i - 1] = Encoding.ASCII.GetBytes(chars, index, chars.Length - index);
}
else
{
bufferArray[i - 1] = Encoding.ASCII.GetBytes(chars, index, 0x20);
index += 0x20;
}
}
string str4 = str;
for (int j = 0; j < bufferArray.Length; j++)
{
str3 = str3 + Convert.ToBase64String(provider.Encrypt(bufferArray[j], true));
}
return str3;
}
// Properties
public string Private_Key
{
get
{
return this.prk;
}
set
{
if (value != null)
{
this.prk = value;
}
}
}
public string Public_Key
{
get
{
return this.pk;
}
set
{
if (value != null)
{
this.pk = value;
}
}
}
}
public class HashCalculate
{
// Methods
public HashCalculate()
{}
public static string HashMD5(byte[] file)
{
MD5CryptoServiceProvider provider = new MD5CryptoServiceProvider();
byte[] buffer = file;
byte[] inArray = provider.ComputeHash(buffer);
provider.Clear();
return Convert.ToBase64String(inArray);
}
}
public class SymetricCryptography
{
public SymetricCryptography()
{
}
// Fields
private SymmetricAlgorithm mCSP = new DESCryptoServiceProvider();
// Methods
public byte[] DecryptFile(byte[] file)
{
ICryptoTransform transform = this.mCSP.CreateDecryptor(this.mCSP.Key, this.mCSP.IV);
byte[] buffer = file;
MemoryStream stream = new MemoryStream();
CryptoStream stream2 = new CryptoStream(stream, transform, CryptoStreamMode.Write);
stream2.Write(buffer, 0, buffer.Length);
stream2.FlushFinalBlock();
stream2.Close();
return stream.ToArray();
}
public string DecryptString(string Value)
{
ICryptoTransform transform = this.mCSP.CreateDecryptor(this.mCSP.Key, this.mCSP.IV);
byte[] buffer = Convert.FromBase64String(Value);
MemoryStream stream = new MemoryStream();
CryptoStream stream2 = new CryptoStream(stream, transform, CryptoStreamMode.Write);
stream2.Write(buffer, 0, buffer.Length);
stream2.FlushFinalBlock();
stream2.Close();
return Encoding.UTF8.GetString(stream.ToArray());
}
public byte[] EncryptFile(byte[] file)
{
ICryptoTransform transform = this.mCSP.CreateEncryptor(this.mCSP.Key, this.mCSP.IV);
byte[] buffer = file;
MemoryStream stream = new MemoryStream();
CryptoStream stream2 = new CryptoStream(stream, transform, CryptoStreamMode.Write);
stream2.Write(buffer, 0, buffer.Length);
stream2.FlushFinalBlock();
stream2.Close();
return stream.ToArray();
}
public string EncryptString(string Value)
{
ICryptoTransform transform = this.mCSP.CreateEncryptor(this.mCSP.Key, this.mCSP.IV);
byte[] bytes = Encoding.UTF8.GetBytes(Value);
MemoryStream stream = new MemoryStream();
CryptoStream stream2 = new CryptoStream(stream, transform, CryptoStreamMode.Write);
stream2.Write(bytes, 0, bytes.Length);
stream2.FlushFinalBlock();
stream2.Close();
return Convert.ToBase64String(stream.ToArray());
}
public string Initialization_Vector
{
get
{
this.mCSP.GenerateIV();
return Convert.ToBase64String(this.mCSP.IV);
}
set
{
if (value != null)
{
this.mCSP.IV = Convert.FromBase64String(value);
}
}
}
public string Sessio_Key
{
get
{
this.mCSP.GenerateKey();
return Convert.ToBase64String(this.mCSP.Key);
}
set
{
if (value != null)
{
this.mCSP.Key = Convert.FromBase64String(value);
}
}
}
}
|
|
|
|
|
Firstly, have you not noticed that there is an asp.net forum?
Secondly, TOO MUCH CODE
Thirdly, which line is causing the error? Failing that, give us a clue. Which method contains the line?
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.”
|
|
|
|
|
You may need to specify/change the padding mode[^]
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)
|
|
|
|
|
I'm making a small backup application. And I want the user to be able to drag files and folders from the - file explorer style - TreeView(treeOne) to the second TreeView(treeTwo)
Drag and Drop works fine, exept when I'm dropping a file/folder into treeTwo.
In the Treeview treeTwo node, i can't get access to the full path of the original file/folder, or the parent nodes. And I need this to process the files
example;
I drag temp\blah\ folder from treeOne to treeTwo ... now in treeTwo i only have temp\blah (the root information (my computer\c:\ isn't included)
so no access to the parent nodes (c;\) or fullpath.
I tried everythin to bring them over, stick the fullpath in the tag property.
Tryed to make a new 'supernode' , inheriting treeNode and add some properties. butthat didn't work.
without that fullPath i can't process the files or folders.
Im so close to a sollution if I could just drag/drop the whole node tree over, with all the parent and sub nodes.
anyone can help me out a bit, know a sollution, an idea , some resources of how other ppl done it ... verry much appreciated
regards
|
|
|
|
|
TreeNode has a FullPath property. Have you tried using that?
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.”
|
|
|
|
|
yes, but when you drag/drop, you visualy select a node in treeView1 and drag it to treeView2. But what happens in code is you create a new node in treeview2, that takes the name of the selected node in treeView1.
And the new node.FullPath is automatically set in relation to the Treeview2.
I have to find a way to take the FullPath of node1 and copy it to node2 FullPath property. problem is, FullPath is readonly so I can't set it.
I tried creating a class that inherits TreeNode, and add an extra property 'originalPath' but it doesn't work... I'm getting a lot of errors in other functions regarding the TreeView, have to look into that later...
|
|
|
|
|
Hows about, in the OnDrop code, taking the fullpath , splitting it and then check if each part exists in TreeView2 and if not, adding it. If you don't have access to the fullpath at that point you might have to create a DragItem class with fields for the node itself and a string for the fullpath . Use this when starting the drag.
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.”
|
|
|
|
|
yeah, I think I'm going to try the DragItem class sollution, seems the most reliable
and I can add some other properties like include subfolders, etc ... (it's for a backup project)
thanx
|
|
|
|
|
Ok.
Good luck!
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.”
|
|
|
|
|
Greeting,
I want to monitor the data that I received continuously.I use Datagridview control to monitor data(a data received as a structure of some fields and i show them as some columns )
It seems the Datagridview is slow and when number of records is growing this control will be very slow.
Which control is better?
I should monitor data in some columns , and every columns should has title.
Thanks
|
|
|
|
|
A datagridview has a lot of intelligence for sorting and the likes. Lots of data makes every control slow. Fill a textbox with 10Mb and you'll see what I mean
If it's for personal viewing then you might consider using a TextBox with a fixedsize-font.
I are troll
|
|
|
|
|
In my current c# application I need a combobox that can have in it atleast 500 entries. But when I tried to do I, it says it can store at the max! only 100 entries in it.
Is there any way I can set the combo's max drop down items?!
Regards,
na_ab
|
|
|
|
|
then just put 500 items in, its not a problem.
The MaxDropDownItems value is the number of item to be displayed during drop down at any one time. Which is limited to 100
May i also just suggest that a combo box with so many items is not very user friendly IMO
If only MySelf.Visible was more than just a getter...
A person can produce over 5 times there own body weight in excrement each year... please re-read your questions before posting
|
|
|
|
|
this is can change simply.
first you must change the property DropDownHeight (Default value 106 you can change to 100) and then reset it again(to 106).
then you can change the value in maxDropDownItems = 10 or your value.
it's work great.......!!!!!!!!
thanks
gihan
gihan_chandima@yahoo.com
|
|
|
|
|
Hi.
Why do i get this error when opening a file as bitmap : "Parameter is not valid"
I'm trying to open a .tif file, with calling a funtcion.
The code:
Bitmap tif = new Bitmap(fileName, false);
I googled a bit and tried with casting the bitmap like this:
"bitmap tif = (bitmap)bitmap.fromfile(filename);"
but i got another error saying - "out of memory".
i also read something with using stream, but didnt quite get it on how to work...
Can someone please help?
PS: the tif file has 4 EMPTY pages. And everything stopped only with this file. Many tifs before went through well.
Thanks in advance.
Regards,
Matjaž
|
|
|
|
|
Since you are setting the second param (useIcm, i think) to false, omit it altogether.
Bitmap tif = new Bitmap(filename);
If you still get the error, then it is likely that the tif file has been created in an unorthodox (to MS, at least) way.
As far as using streams is concerned try something like:
Bitmap tif = null;
using (FileStream fs = new FileStream(filename, FileMode.Open))
{
tif = new Bitmap(fs);
}
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.”
|
|
|
|
|
Anybody help me
In my application, we used to the tableLayoutPanel , the 24 rows and 7 coloums
But show only 10 rows , after that all are in scroll bar. Now what i am want means, if scroll the mouse ,tableLayoutPanel didn't scroll. can i set any property or write the code to the mousewheel callback event.
Thanks.
|
|
|
|
|
Does the TableLayoutPanel have Focus ?
IIRC it will only scroll when focussed.
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,
I am developing an smartdevice application to convert text to speech using Visual Studio 2008 with .NET Compact Framework 3.5 and C#..
I learnt that SpeechLib is the namespace used for this conversion..
While using this namespace the error i received is
Error: The type or namespace name 'SpeechLib' could not be found (are you missing a using directive or an assembly reference?)
What should i do inorder to rectify this error??
Thanks in advance..
|
|
|
|
|
YOu need to make a reference to the Library.
Excellence is doing ordinary things extraordinarily well.
|
|
|
|
|
Hi,
Thanks for ur fast reply..
I tried adding reference to the library by right clicking on the smartdeviceproject>add reference.. from that i chose browse tab, selected C:>program files>reference assemblies>microsoft>framework>v 3.0 >System.speech.dll
Is the way i proceeded is correct..If not Can u tell me how to make the reference to the library..
Thanks once again..
|
|
|
|