|
Did you register for the event multiple times?
|
|
|
|
|
I use two radiobuttons and a "continue" button. after pressing the "continue" button i need that there won't be a way to change anymore the radios.
please help!
|
|
|
|
|
radioButton1.Enabled = false;
RageInTheMachine9532
|
|
|
|
|
Hi,
I'm building a simulation of a site in c# code, and using HttpRequest, when I'm calling the GetRequestStream() method, an Exception is thrown :
"The remote server returned an error: (501) Not Implemented."
Tried to sniff it in the Explorer and what I'm supposed to get is a redirection with type "magnus-internal/fcc" with size of 0. (no string is returned)
This redirection also returns a cookie, that I need, so I can't skip it.
Is anyone ever encountered something similar?
Thanks
Shay Erov
|
|
|
|
|
how can i copy a file to a website, ie. file.ext ---> http://site.site.com/folder
it's not ftp, it's http that i need to use. any help would be great.
thanks,
Rob Tomson
--
There are 10 kinds of people. Those who understand binary and those who don't.
|
|
|
|
|
If no FTP is available, you're going to have to find out if the site supports file posts via http and what http form or mechanism is supposed to be used. There's no generic way of doing it that works for all sites. Other than FTP that is...
RageInTheMachine9532
|
|
|
|
|
the way i've been putting my files in is creating a webfolder in windows and then copying my file(s) onto the site. just out of curiosity how do i upload a file via ftp also?
thanks,
Rob Tomson
--
There are 10 kinds of people. Those who understand binary and those who don't.
|
|
|
|
|
(this isn't really a C# topic but whatever ) Go to google and find a FTP client. There are some ones that present users with a drag and drop interface for you.
|
|
|
|
|
What you're using then is WebDAV, which uses different HTTP headers to post files. Try a search in google for more information.
To upload files using FTP, you can P/Invoke the relevent WinInet APIs or create your own WebRequest /WebResponse derivative classes (there's plenty of documentation about this in the .NET Framework SDK) that implements that simple FTP protocol, which you can also find plenty of information about by searching with google.
Microsoft MVP, Visual C#
My Articles
|
|
|
|
|
just an update; i succesfully wrote a text string to a file on an http site. if you have any suggestions please let me know.
<br />
private void publish()<br />
{<br />
this.Cursor = System.Windows.Forms.Cursors.WaitCursor;<br />
this.btnPublish.Enabled = false;<br />
this.btnPublish.Text = "Wait...";<br />
<br />
System.Net.WebClient client = new System.Net.WebClient();;<br />
string fullPath;<br />
string fileText;<br />
byte[] byteArray;<br />
System.IO.Stream stream;<br />
System.IO.StreamWriter sWriter;<br />
<br />
fullPath = this.xml.Find("BaseURL") + '/' + this.xml.Find("PublishName") + ".ics";<br />
fileText = this.convertiCal();<br />
byteArray = System.Text.Encoding.ASCII.GetBytes(fileText);<br />
client.Credentials = new System.Net.NetworkCredential(this.xml.Find("Login"), this.xml.Find("Password"));<br />
stream = client.OpenWrite(fullPath, "PUT");<br />
sWriter = new System.IO.StreamWriter(stream);<br />
sWriter.Write(fileText);<br />
<br />
try<br />
{<br />
sWriter.Flush();<br />
sWriter.Close();<br />
}<br />
catch (System.Net.WebException err)<br />
{<br />
System.Windows.Forms.MessageBox.Show(err.Message, "Error", System.Windows.Forms.MessageBoxButtons.OK);<br />
}<br />
client.Dispose();<br />
<br />
this.btnPublish.Text = "&Publish";<br />
this.btnPublish.Enabled = true;<br />
this.Cursor = System.Windows.Forms.Cursors.Default;<br />
}<br />
thanks for the help,
Rob Tomson
--
There are 10 kinds of people. Those who understand binary and those who don't.
|
|
|
|
|
Hello,
I have the following code in a win app:
// create bitmap from file
Bitmap myBitmap = new Bitmap(textBox1.Text);
Graphics g = Graphics.FromImage(myBitmap);
g.RotateTransform(30); //rotate 30 degrees
// create a new bitmap from the Graphics object
Bitmap next = new Bitmap(myBitmap.Width, myBitmap.Height, g);
// save the new bitmap to disk
next.Save("c:/documents and settings/vortex/Desktop/file.jpg");
When this code is executed, an empty image file with the right dimensions is stored - just a blank (white) image... I tried without rotating, but nothing happened either.
I would appreciate if you could give me any hints about the problem.
Thank you in advance.
"Needless redundancy is the hobgoblin of software engineering." - Peter Darnell
|
|
|
|
|
The constructore you used for your second Bitmap is wrong, its just use resolution of graphic object. You have to use Bitmap.Clone() method to create copy of your Bitmap .
Mazy
"I think that only daring speculation can lead us further and not accumulation of facts." - Albert Einstein
|
|
|
|
|
It seems you understood the whole point wrongly...
My intentions are to load a bitmap, manipulate it (e.g. Rotate it), and finally save it to another file...
I thought the steps I described ( Bitmap->Graphics->Bitmap->file) could do it, but there was something wrong in that code.
I strictly followed the MSDN documentation, but still I was unable to achieve this...
"Needless redundancy is the hobgoblin of software engineering." - Peter Darnell
|
|
|
|
|
Vladimir Georgiev wrote:
// create a new bitmap from the Graphics object
Bitmap next = new Bitmap(myBitmap.Width, myBitmap.Height, g);
Dont do that! Just save "myBitmap"
top secret
|
|
|
|
|
Saving myBitmap does not save the rotated bitmap:
// file is a 24-bit .bmp file
Bitmap myBitmap = new Bitmap(textBox1.Text);
Graphics g = Graphics.FromImage(myBitmap);
g.RotateTransform(30);
myBitmap.Save("c:/documents and settings/vortex/Desktop/file123.bmp");
My main purpose is to open a bitmap, get some pixels from it, calculate the rotation degree based on those pixels, rotate and save the bitmap.
MSDN says that you could create a Graphics object from a bitmap, and vice-versa as well... But it does not work...
Any help is highly appreciated.
"Needless redundancy is the hobgoblin of software engineering." - Peter Darnell
|
|
|
|
|
Vladimir Georgiev wrote:
g.RotateTransform(30);
I think you are reading the function wrong. This just adjusts your "perspective" from a drawing point of view. IOW anything drawn after that will be "tilted".
Thats said do this:
Bitmap myBitmap = new Bitmap(textBox1.Text);
Bitmap newb = myBitmap.Clone() as Bitmap;
Graphics g = Graphics.FromImage(newb);
g.RotateTransform(30);
g.DrawImage(myBitmap);
newb.Save("c:/documents and settings/vortex/Desktop/file123.bmp");
top secret
|
|
|
|
|
For all you grid programmers out there.
I'm working on a very simple grid solution and I have a question. I've seen some commercial products (Syncfusion) that have the ability to customize cells with customer cell models and renderers. One of the cells you can create is a custom control cell. The catch here is that the grid uses only one instance of the control to render all the cells that use that cell type.
I just need to know how to use a single instance of a control, reconfigure it for every cell with new cell data, and paint in different area of the grid control.
|
|
|
|
|
AK wrote:
I just need to know how to use a single instance of a control, reconfigure it for every cell with new cell data, and paint in different area of the grid control.
Why on earth do you wanna "copy" there stupid design? Do it just like owner drawn menus, combobox's and type convertors. Using a control as a singleton in this situation is absurd , and most likely not even contained in the grid, and it methods are purely used for rendering. You dont need a control for that, just a static method in a class will suffice.
top secret
|
|
|
|
|
By the way, I've done quite a bit of grid before. Using a simple custom cell drawing is nothing new to me. I understand that I dont need a control to get the cell to pain properly. The reason I want to have a control is because I need a real control to interact with when the cell is focused.
I was hoping that someone knew how to "abuse" the painting code of the control to get the control to paint itself into a certain area of my grid without having to actually create a million instances of the control and aligning them to form a grid.
|
|
|
|
|
Actually you extend the datagridColumn class. Once there you can override paint methods for drawing, add controls and use GetValueAtRow and SetValueAtRow.
www.syncfusion.com has a faq thats excellent for this
nick
I'm not an expert yet, but I play one at work. Yeah and here too.
|
|
|
|
|
I got it figured out. Thanks for trying guys.
A clue for others that need to do something similar. Use native methods. 1. Get WindowDC 2. Create compat bitmap 3. select the object 4. Send WM_PRINT message to window specifying the memory DC as the device context
|
|
|
|
|
I want to remove a row from my database based on the instance of a title.
For example if i enter win32newb as the title it will filter the database to only include that row and delete it. Here is what i have in my code but it doesn't work. It throws an exception saying the current status is closed.
private void removebutton_Click(object sender, System.EventArgs e)
{
string strSQL = "DELETE * FROM Movie WHERE Title = ";
strSQL += searchbox.Text;
oleDbDeleteCommand1.CommandText = strSQL; //add the string to deletecommand
oleDbDataAdapter1.DeleteCommand = oleDbDeleteCommand1;
oleDbDeleteCommand1.Connection = oleDbConnection1;
oleDbDeleteCommand1.ExecuteNonQuery();
}
If you know of an easier method I'm open for suggestions. Anything that works pretty much. Thanks. Also, how would i make it where if the title that is entered doesn't exist it would not execute cause wouldn't that throw an exeception also if the title doesn't exist?
Thanks in again
Win32newb
"Making windows programs worse than they already are"
|
|
|
|
|
win32newb wrote:
oleDbDeleteCommand1.Connection = oleDbConnection1
Best is to open and close the connection just before and after the "executenonquery".
win32newb wrote:
Also, how would i make it where if the title that is entered doesn't exist it would not execute cause wouldn't that throw an exeception also if the title doesn't exist?
Use a try/catch
top secret
|
|
|
|
|
thanks for the reply. I have a question maybe you or someone else can help with. Either my sql statement is not correct or something. I keep getting an exception because the catch keeps showing up.
I have a database with a table called Movie and it has fields Information and Title.
I have a test value in there called tony.
thanks for the help.
try
{
string strSQL = "DELETE * FROM Movie WHERE Title = ";
strSQL += searchbox.Text;
oleDbDeleteCommand1.CommandText = strSQL;
oleDbDataAdapter1.DeleteCommand = oleDbDeleteCommand1;
oleDbDeleteCommand1.Connection = oleDbConnection1;
oleDbDeleteCommand1.Connection.Open();
oleDbDeleteCommand1.ExecuteNonQuery();
oleDbDeleteCommand1.Connection.Close();
}
catch
{
MessageBox.Show("Not found");
}
Win32newb
"Making windows programs worse than they already are"
|
|
|
|
|
win32newb wrote:
catch
{
MessageBox.Show("Not found");
}
replace that with:
catch (Exception ex)
{
MessageBox.Show(ex.Tostring());
}
You will get a MUCH better error condition, and if you dont know what to do with it, I'm sure many a person on CP will be able to help
top secret
|
|
|
|