|
Is this in ASP.NET pages?
You might have a postback problem...?
|
|
|
|
|
Hi,
This is an ASP.NET code-behind file. But there is no post back here. I click Button A and dataset gets filled with data. Now I put a break point in button B click event and inside that button I check if this dataset using Quick Watch in VS 2003. But although inside Button A click event handler the ds showed 1 Table, inside B's click handler its showing zero Tables.
|
|
|
|
|
I think the page is redeclaring the DS when you click the first button.
Try to add the DS to viewstate.
Then in the 2nd button, use the DS from viewstate.
|
|
|
|
|
ViewState is not returning data as well, I am now populating a DataSet everytime I need to get the data.
|
|
|
|
|
How do i writ a code to extract a file and save it in a folder?
|
|
|
|
|
|
I actually need a code in c# to extract files from a folder that was extracted from a SWIFT machine
|
|
|
|
|
What is a SWIFT machine ? Is the folder compressed ? As a zip, or something else ?
Christian Graus - Microsoft MVP - C++
Metal Musings - Rex and my new metal blog
"I am working on a project that will convert a FORTRAN code to corresponding C++ code.I am not aware of FORTRAN syntax" ( spotted in the C++/CLI forum )
|
|
|
|
|
Its just an ordinary folder (very large though) that has a lot of files and i need a code to extract these files and save into different folders for easy accessibility
|
|
|
|
|
Use
System.IO.StreamReader;<br />
System.IO.StreamWriter;
|
|
|
|
|
after using
System.IO.StreamReader;
System.IO.StreamWriter;
then what next.I actually need a procedure,thanks
|
|
|
|
|
Hope this helps:
try<br />
{<br />
string fileContents;<br />
<br />
using (StreamReader sr = new StreamReader(FileName))<br />
{<br />
fileContents = sr.ReadToEnd();<br />
}<br />
return fileContents;<br />
}<br />
catch (Exception exc)<br />
{<br />
return exc.Message;<br />
}
To write contents to a file use StreamWriter instead of StreamReader .
Then use yourStreamWriterObject.Write(ContentWritten); to write the contents to a file.
Hope this is helpful enough to you.
|
|
|
|
|
If you're just moving/copying files from one place to another then File.Copy and File.Move may interest you.
|
|
|
|
|
I am having a samll problem i want to add no of days to a dte variable using c#.net. Say suppose the date variable is haveing a date 25/05/2007. If i add 7 day to it i should get 01/06/2007. Can any one help me in this regard.
thanx in advance
prashanth,
s/w Engineer,
Syfnosys.
|
|
|
|
|
hi,
adding days,months,... is not that hard. the DateTime structure provides the function for that.
just do the following:
DateTime dt = DateTime.Now; //getting present date and time
dt.AddDays(7);// adding 7 days to it
dt.AddDays(-4);// subtracting 4 days
hope this helps
regards
|
|
|
|
|
DateTime dt = new DateTime(2007, 05, 25);<br />
dt = dt.AddDays(7);
|
|
|
|
|
You can use Datetime.AddDays method
|
|
|
|
|
Bitmap bm = new Bitmap(@"c:\Hamtaro.jpg");
Graphics gr = Graphics.FromImage(bm);
gr.DrawString("Hello Graphics", new Font("Verdana", 10),
new SolidBrush(Color.Tomato), 1, 40);
Error 1 Cannot implicitly convert type 'System.Drawing.Image' to 'System.Drawing.Bitmap'. An explicit conversion exists (are you missing a cast?)
And sorry, how do you save it eventually??
Smile: A curve that can set a lot of things straight!
(\ /)
(O.o)
(><)
|
|
|
|
|
hi,
i don't see why the code doesn't work??
i tried the code below and it worked fine.
you can use the save function to save the new image.
Bitmap bm = new Bitmap(@"c:\testimage.jpg");<br />
Graphics gr = Graphics.FromImage(bm);<br />
gr.DrawString("Hello Graphics", new Font("Verdana", 10),new SolidBrush(Color.Tomato), 1,40);<br />
gr.Dispose();<br />
bm.Save(@"c:\testimage2.jpg");
regards
|
|
|
|
|
Funny, it's working real fine now
Thank you so much 1119
Smile: A curve that can set a lot of things straight!
(\ /)
(O.o)
(><)
|
|
|
|
|
you're still not cleaning up your resources.
using (Bitmap bm = Bitmap.FromFile(@"c:\Hamtaro.jpg")/* as Bitmap */)
{
using (Graphics gr = Graphics.FromImage(bm))
{
using (Font f = new Font("Verdana", 10))
{
gr.DrawString("HelloGraphics", f, Brushes.Red, 1, 40);
bm.Save(@"c:\Hamtaro.bmp");
}
}
}
Christian Graus - Microsoft MVP - C++
Metal Musings - Rex and my new metal blog
"I am working on a project that will convert a FORTRAN code to corresponding C++ code.I am not aware of FORTRAN syntax" ( spotted in the C++/CLI forum )
|
|
|
|
|
It's working fine now, thanks Christian.. You are a good man
Smile: A curve that can set a lot of things straight!
(\ /)
(O.o)
(><)
|
|
|
|
|
One more question Christian
Can you tell me how do I set the modified bitmap now to a picturebox control??
Thanks a bunch
Smile: A curve that can set a lot of things straight!
(\ /)
(O.o)
(><)
|
|
|
|
|
Just pass it to the control. mypicturebox.Image = bm;
Christian Graus - Microsoft MVP - C++
Metal Musings - Rex and my new metal blog
"I am working on a project that will convert a FORTRAN code to corresponding C++ code.I am not aware of FORTRAN syntax" ( spotted in the C++/CLI forum )
|
|
|
|
|
Thanks again
Smile: A curve that can set a lot of things straight!
(\ /)
(O.o)
(><)
|
|
|
|