|
|
what are the coding or events used in server control "button" ant "link button" i got a job to teach c# asp .net and i want to give examples to my student by doing coding in server control. plz help me.
|
|
|
|
|
This is an ASP.NET question, please don't cross post.
Christian Graus
Driven to the arms of OSX by Vista.
|
|
|
|
|
I have a generic type:
class X<T> ...
At runtime, I receive a value and I want to make a constructed type for its type;
if I receive an int , I want to make an X<int>
I don't see a way of doing that, so at this time I make the caller do it and pass both.
X<value.GetType()> and X<typeof(value)> don't cut it.
I expect I'll need Reflection.Emit or something to do this so I'm wondering whether or not anyone here had done this or found an easier way.
Because I have a reasonable work-around, I'm not very motivated to delve into Emit... and it's not URGENT!!
Later that day...
A little while after I posted this, a colleague called and asked me the same thing!
I decided to look into it further and found...
System.Type t = typeof ( X<> ) .MakeGenericType ( new System.Type[] { value.GetType() } ) ;
It was right there in the documentation all along.
modified on Saturday, December 6, 2008 12:43 AM
|
|
|
|
|
|
|
in my program i create a dataset fill it with data from an excel file using datadaper and showing the result in a datagridview.
after i make some changes on the datagrid i save them back to the dataset.
how can i apply the changes to the excel file which i first read from ?
|
|
|
|
|
Through office interop.
Christian Graus
Driven to the arms of OSX by Vista.
|
|
|
|
|
I am trying to run a status counter in a text box that overwrites itself. Ex. "Sending Line 200 of 1249". However I do not want to erase everything in the text box because it is the console window, so I need it to only overwrite the one line. I have tried the text.Remove method without success. Below is what I have been trying but is not working for some reason even thought all lengths are reporting correctly, the text.remove command does not work as well as the text.undo. Are there any recommendations how to do this?
int lastLength = this.textBoxConsole.Text.Length;
int currentLength = this.textBoxConsole.Text.Length;
while (SerialBootload.HexFile.downloadCompleted == false)
{
this.textBoxConsole.Text.Remove((lastLength - 1), (currentLength - lastLength));
this.textBoxConsole.AppendText(SerialBootloadMethods.SerialBootload.SendProgram(1, 2));
currentLength = this.textBoxConsole.Text.Length;
}
|
|
|
|
|
You don't understand how strings work. Strings are immutable, methods like remove, return a string.
this.textBoxConsole.Text = this.textBoxConsole.Text.Remove(xxx, yyy);
Christian Graus
Driven to the arms of OSX by Vista.
|
|
|
|
|
Thanks, that is all I was missing. I forget little things like that while switching between embedded c and c# all day.
|
|
|
|
|
Please give me the source code for REMINDER in ASP.NET with C#
Please help me out
|
|
|
|
|
shobhatai wrote: Please give me the source code for REMINDER in ASP.NET with C#
Please help me out
Please come round and tile my bathroom. Oh wait, does this come as a surprise to you - that we would want payment for providing you with complete code? It's not freakin' Rentacoder here.
|
|
|
|
|
Pete O'Hanlon wrote: want payment for providing you with complete code
Yeah, he can come by my house and shovel out my driveway through 3 feet of heavy, wet snow when I get some
"The clue train passed his station without stopping." - John Simmons / outlaw programmer
"Real programmers just throw a bunch of 1s and 0s at the computer to see what sticks" - Pete O'Hanlon
"Not only do you continue to babble nonsense, you can't even correctly remember the nonsense you babbled just minutes ago." - Rob Graham
|
|
|
|
|
shobhatai wrote: Please give me the source code for REMINDER in ASP.NET with C#
Please help me out
You forgot to mention it's urgent.
|
|
|
|
|
Kristian Sixhoej wrote: forgot to mention it's urgent
[Homer Simpson VO] Doh! [/Homer Simpson VO]
"The clue train passed his station without stopping." - John Simmons / outlaw programmer
"Real programmers just throw a bunch of 1s and 0s at the computer to see what sticks" - Pete O'Hanlon
"Not only do you continue to babble nonsense, you can't even correctly remember the nonsense you babbled just minutes ago." - Rob Graham
|
|
|
|
|
Response.Write("Reminder: do your own work in future");
Christian Graus
Driven to the arms of OSX by Vista.
|
|
|
|
|
Code it yourself
"The clue train passed his station without stopping." - John Simmons / outlaw programmer
"Real programmers just throw a bunch of 1s and 0s at the computer to see what sticks" - Pete O'Hanlon
"Not only do you continue to babble nonsense, you can't even correctly remember the nonsense you babbled just minutes ago." - Rob Graham
|
|
|
|
|
Hi
When I create a filestream I have passed a filename in the constructor. Later on how I can detach the existing file from the filestream and attach a new file with existing filestream.
thank you.
|
|
|
|
|
Hi,
I don't think the .NET Framework offers that functionality, one (or more) FileStreams can be attached to a file but are necessarily open as long as the FileStream exists; the file has to be identified by name or handle when the FileStream gets constructed.
If you want to close the file and open another one without the FileStream reader/writer feeling it, AFAIK you would have to derive your own class from FileStream and implement the extra functionality yourself.
|
|
|
|
|
Hi All,
Sorry about the rapid-fire questions, but I'm making a ton of progress with my project. Thank you to everyone who's helped me so far, and thanks in general to CodeProject--this site is heavily visited when I need something done.
For my next question, I need to know how to copy a file from one location to another while still keeping the same directory structure. An example would be:
c:\foo\bar\123.txt ---copy---> c:\copy\foo\bar\123.txt
I get an exception saying part of the path couldn't be found.
I can get to the original file just fine, so it exists where strOrigFile says it does. The destination path looks all right--the only difference being the highest parent directory being "Symbiosys_Backup" instead of "Files".
But I don't know what to do about this exception.
Do I have to recursively create directories as I go, or is there a ninja-sneaky way of pulling this off without pulling my hair out?
Code that I have is below.
private void button4_Click(object sender, EventArgs e)
{
string strOrigFile = "Files\\testfile.txt";
string strDestFile = "C:\\Symbiosys_Backup\\" + (System.IO.Path.GetFullPath(strOrigFile)).Replace(@"C:\", @"");
string strFileName = System.IO.Path.GetFileName(strOrigFile);
MessageBox.Show("Original File: " + strOrigFile + "\r\nDestination File: " + strDestFile);
System.IO.File.Copy(strOrigFile, strDestFile, true);
}
Thanka you,
Michael Fritzius
|
|
|
|
|
Hi,
directories don't get created automatically, so if (part of) the destination path does not exist, the copy will fail. You can use Directory.CreateDirectory() to first create the directory (even if it already exists), or you can first test for its absence, then create it, then copy the file(s).
You might also be interested in the Path class.
|
|
|
|
|
Got it. Thanks Luc. Very helpful. I ended up having to get only the directory from the big long string describing the destination file. Checking to see if that Exists() and then creating it if not was what the solution needed. I now have a directory with a subdirectory containing a carefully uprooted file structure.
Michael Fritzius
|
|
|
|
|
I have all of my data in a MySQL database and have the program working well with this database. Now when looking at creating an install CD for my program I have had issues in figuring out how I can deploy it. I would like the current tables to be installed with the MySQL database since my software mostly just searches the data. Just wondering if anyone else has accomplished this.
Also if I have to, was looking at maybe using SQL Server Express but couldn't quite find a good explanation of how that would work better.
Thanks in advance.
|
|
|
|
|
I think what you're looking for is SQL Server Compact Edition, not SQL Server Express edition. SSCE requires only an installation of one or two .NET assemblies, and operates against a database file that can be located anywhere on the filesystem. Also, with SSCE, you can provide a "starter" file with your application with the schema and data already populated.
|
|
|
|