|
hi!
ok here's what i want to do exactly:
i want to keep showing the rows with errors and in the same time, enable the user to add and edit other rows.
that's why, i'm asking if there's a way to put a row in an unbound mode ?
thks in advance.
C# is the future, but who can see the future :p
|
|
|
|
|
You can do so, however you must understand the issues in doing so.
When a DataGridView does a refresh, each cell looks to see if it is bound. If it is, then it gets the value from the datatable and refreshes it's data. Now if you have data in an unbound cell, the value is only within that cell itself. If the user sorts your datatable or maybe even does a minimize/maximize, the data contents will be lost.
(A good example of this is adding a checkbox field that is unbound. Check the box and behavior is great. Sort the grid and your selected fields are gone)
You can add rows to your datatable to represent the added fields to bypass these issues....or deactivate these features of the control.
|
|
|
|
|
I want to process a text file line by line. how can i loop through all the line in a text file one by one
|
|
|
|
|
.NET 2.0:
string[] lines = File.ReadAllLines(@"C:\myfile.txt");
.NET 1.1 (directly copied from MSDN):
try
{
using (StreamReader sr = new StreamReader("TestFile.txt"))
{
String line;
while ((line = sr.ReadLine()) != null)
{
Console.WriteLine(line);
}
}
}
catch (Exception e)
{
Console.WriteLine("The file could not be read:");
Console.WriteLine(e.Message);
}
regards
modified 12-Sep-18 21:01pm.
|
|
|
|
|
|
Hi,
Does anyone know when the .NET 2.0 portal will be available??
Are there any other goof portals out there that I can work though?
I have the code of the following potals:
DotNetNuke
CommunityServer
CommerceStarterKit
Regards
ma se
|
|
|
|
|
hi,
if i press a delete button in parrent form form3 (how is in fact also a child of another form)
i want to get a " are you sure? yer or no " screen so i made this in another form, form5.
if i press no i just close form 5 but if i press yes something in the parent from has to happen.
how do i do this?
how do i make a sort of variable that works for both the forms?
anybody any ideas
links are also helpful
thx
|
|
|
|
|
Create a public boolean property in a message dialog form, say YesClicked. On click of yes button set this property to true... This way you can get value from the dialog form.
|
|
|
|
|
thx
i forgot to delete
delform.MdiParent = this.MdiParent;
at fist
its working fine now, but ...
if the delete form comes up its not a child of something. is there a way to still use showdialog an get only one form opening (like the childs do in a parent)?
thx anyway you've been a great help
bye
|
|
|
|
|
Hi folks,
Ive been working on a little app that lets u choose a file from your PC and encrypts it using AES encryption(Rijndael). The encrypted bytes are stored in Sql Server. I wanted to be able to retrieve the encrypted bytes so I can decrypt them. The process works fine. However when i open the decrypted file I have a ton of gibberish looking characters appended file but the decrypted text is fine.
For example, this is what the decrypted text looks like.
testing today Õ/þ°A¦ðI.Dº99ï_qýÆ;ßfÞàV¥u> øï_qýÆ;ßfÞàV¥u> øï_qýÆ;ßfÞàV¥u> øï_qýÆ;ßfÞàV¥u> øï_qýÆ;ßfÞàV¥u> øï_qýÆ;ßfÞàV¥u> øï_qýÆ;ßfÞàV¥u> ...... it continues on for a while.
Can my goals even be achieved with this method? I have heard there are issues with doing this due to how SQLServer stores binary and padding issues with AES. Here is the code.
public string EncryptFileData(string filename)
{
FileStream fsIn = new FileStream(filename, FileMode.Open, FileAccess.Read);
byte[] buffer = new byte[4096];
int bytesRead = fsIn.Read(buffer, 0, buffer.Length);
MemoryStream ms = new MemoryStream();
Rijndael alg = Rijndael.Create();
alg.Padding = PaddingMode.None;
PasswordDeriveBytes pdb = new PasswordDeriveBytes(@"test",
new byte[] {0x49, 0x76, 0x61, 0x6e, 0x20, 0x4d,
0x65, 0x64, 0x76, 0x65, 0x64, 0x65, 0x76});
alg.Key = pdb.GetBytes(32);
alg.IV = pdb.GetBytes(16);
try
{
CryptoStream cs = new CryptoStream(ms, alg.CreateEncryptor(), CryptoStreamMode.Write);
cs.Write(buffer, 0, buffer.Length);
cs.Close();
byte[] encData = ms.ToArray();
SqlConnection conn = new SqlConnection(Settings1.Default.Properties["str"].DefaultValue.ToString());
conn.Open();
SqlCommand cmd = new SqlCommand();
cmd.Connection = conn;
cmd.CommandType = CommandType.StoredProcedure;
cmd.CommandText = "spStoreFileContent";
cmd.Parameters.AddWithValue("@FileName", @"c:\test\test.aop");
cmd.Parameters.AddWithValue("@EFileContent", encData);
cmd.ExecuteNonQuery();
conn.Close();
return "Cool Beans";
}
catch (SystemException sx)
{
return sx.Message;
}
}
public string DecryptFileData()
{
string sfiletemp = @"c:\test\test.aop";
byte[] content = new byte[4096];
SqlConnection conn = new SqlConnection(Settings1.Default.Properties["str"].DefaultValue.ToString());
conn.Open();
SqlCommand cmd = new SqlCommand();
cmd.Connection = conn;
cmd.CommandType = CommandType.StoredProcedure;
cmd.CommandText = "spGetFileContent";
cmd.Parameters.AddWithValue("@FileName", sfiletemp);
SqlDataReader sr;
sr = cmd.ExecuteReader();
string n;
long totalBytes;
while (sr.Read())
{
n = sr.GetString(1);
totalBytes = sr.GetBytes(2, 0, content, 0, content.Length);
}
MemoryStream ms = new MemoryStream();
Rijndael alg = Rijndael.Create();
PasswordDeriveBytes pdb = new PasswordDeriveBytes(@"test",
new byte[] {0x49, 0x76, 0x61, 0x6e, 0x20, 0x4d,
0x65, 0x64, 0x76, 0x65, 0x64, 0x65, 0x76});
alg.Key = pdb.GetBytes(32);
alg.IV = pdb.GetBytes(16);
FileStream fsOut = new FileStream(@"c:\test\po.txt", FileMode.Create, FileAccess.Write);
CryptoStream cs = new CryptoStream(ms, alg.CreateDecryptor(), CryptoStreamMode.Write);
cs.Write(content, 0, content.Length);
byte[] decData = ms.ToArray();
string r = System.Text.Encoding.ASCII.GetString(decData);
fsOut.Write(decData,0,decData.Length);
fsOut.Close();
//cs.Close();
return r;
}
}
If anyone can give me help. I would be extremely greatful..Happy coding folks.
PS. Note I tried storing and retrieving non encrypted data and it works fine.
|
|
|
|
|
I am working on C# VS1.1 version
We are using Dataset in our code.
When we had one Dataset in the code it gave to problem, but whn we wrote 2 datasets it gives a problem as 'There is already one open datareader associated with this connection which must be closed first'
But we have not used any datareader ...............
Cant we use 2 dataset in one code
Thanks
Regards,
Vaishali
|
|
|
|
|
Can you post your code of populating DataSet?
|
|
|
|
|
Couldn't exactly decide where to put this, hope this is okay. From what I have seen, in order to use click-once the application must be installed via a click-once installer. Even if everything has been setup for click-once, installing via the MSI seems to leave behind the auto-update bootstrap.
I understand that installing via click-once is comparable to running the app in a sandbox, ect ect. What I would like to do, is have the user install the application via MSI (so that I may make registry changes and the like... just for the sake of argument assume that I MUST install via MSI). But I would like to leverage the auto-update functionality of click-once. Is there any way to combine the two?
Visual Studio 2005 Team Edition, C#
|
|
|
|
|
|
Thanks for that. As far as I can tell that still doesn't use an MSI file to perform the installation. I have been searching around for more information all day and I think the official answer is click-once and MSI don't play ball.
But just to confuse matters a little, it does seem that a VSTO add-in does exactly what I want. Installs via a MSI and updates itself via clickonce
|
|
|
|
|
You may want to look up Application Updater Block, that may be more of what you need.
only two letters away from being an asset
|
|
|
|
|
newkie, when you build your ClickOnce app, you typically deploy it with a prerequisites package (a .MSI file) that installs any prerequisites, modifies the registry, the GAC, whatever. To make this part of your prerequisites, you must bootstrap it and make it a prerequisite of your ClickOnce deployment. There's a tool (deployed via ClickOnce) that can generate Visual Studio BootStrap packages for you; all you do is point it to your MSI file, and it will generate it. That application can be installed here[^].
Once you've built a bootstrap for you .MSI file, go into Visual Studio, open up the properties of your ClickOnce project, go into the Publish tab, click the Prerequisites button. Now, your newly created bootstrapper for your MSI package will show up in the checklist. Check it. Now deploy your app via click once. It will generate a webpage that lists prerequisites (it will list your MSI file now), and the page will have a link to Install prerequisites, or launch the application. If you click Install, it will check for any needed prerequisites (.NET framework, your .MSI file, and any others you've specified) and install those on-demand. It's very cool.
|
|
|
|
|
for example, I have
string X;
now I want to know thathow can i write the code for my project, that is X has exactly 10 character in itself or not, and then using if statement for the answer if it is 10 so do this nor something else.
thanks.
You30
|
|
|
|
|
youstring.Trim().Length();
Today is Windows Mobile
|
|
|
|
|
hi to all,
I have to read a file that contains records seperated by commas. Each records in a row may contain different different number of fields. I have to check whether the particular row contains all the necessary records by using the first column of each record. The first column of each row contains the key which is to be used to fetch the data from the database about the columns info of the records.
thanx in advance
|
|
|
|
|
Hey.. looks like this is your class assignment !!
Dude, do some reading & RND.
Regards,
Bhupi Bhai.
|
|
|
|
|
Noops yaar. i m stuck with this becuse i m stuck in this and is unable to think the way i should proceed. if u can help. i have to implement this and it is very urgent..
|
|
|
|
|
You can use StreamReader.ReadLine to read information in the file line by line and String.Split to seperate the records.
"Programming today is a race between software engineers striving to build bigger and better idiot-proof programs, and the Universe trying to produce bigger and better idiots. So far, the Universe is winning." - Rick Cook www.troschuetz.de
|
|
|
|
|
|
Hi,
I am Ravindra,developing a chat messenger using C#.net.
I want to implement personal chatting between two persons .
If anybody knows
please send me the algorithm,how to implement this private chatting
thanks in advance...............
Ravindra
|
|
|
|
|