|
Hi,
I've come up with a solution of disabling .NET security to prevent from throwing weird exceptions when using HttpWebRequest class. All I need to do is to put this xml code :
<?xml version="1.0" encoding="UTF-8" ?>
<configuration>
<system.net>
<settings>
<httpWebRequest useUnsafeHeaderParsing="true" />
</settings>
</system.net>
</configuration>
into config file of my Win app (application.exe.config file).
1. Is there a way to do this from inside the code programaticly?
2. Is there something similar for Ftp WebRequest (which is throwing weird errors too and I have a feeling that it is about security too... ?
thanx
zilo
-- modified at 11:32 Wednesday 7th November, 2007
|
|
|
|
|
|
You'r the man )
zilo
|
|
|
|
|
No, Google's the Man. Fight the Man!!!!
|
|
|
|
|
I'm developing a WinForm using C# and VS2005. I was wonder if it is possible to open up a childForm1 in maximize window of MDIparent and launch childForm2 on top of childForm1, but still keep childForm1 as MAXIMIZE.
Here's a big picture.
childForm1 > childForm2 (childForm1 Maximize and childForm2 on top)
What I'm looking for is the code to keep childForm1 maximize and childForm2 launch on top.
Please please please please please......advice!!!!
Thank you!
|
|
|
|
|
I don't believe it is possible to have a 'non-maximised' child form over the top of a maximised child form.
Setting TopLevel to true throws an error so the only way I can see for you to do it is to resize the child form to the size of the Mdi area (not maximised)... This will allow you to have the other child form(s) over the top of it.
You may need to bring the other forms 'tofront' (.BringToFront ) if the background form is clicked otherwise all front forms will be hidden.
Alternatively... you can put other controls (buttons, labels etc) directly onto a MdiParent form: so if you only want one 'maximised' form... don't actually make it a form, make it a panel (for example) and put all other controls into this. The panel will not be 'allowed' to come forward as it is part of the MdiForm background.
Hope this helps.
Matthew Butler
|
|
|
|
|
Thanks for your reply. I came up with another idea....but still need a little guidance.
Okay, so if my childForm1 is maximize then i launch Form1 by itself, not in MDIParent(frmParent) and if I want to launch childForm2 from Form1 but make it in MDIParent, Maximize and close childForm1. Is it possible?
frmChild2 Child2 = new frmChild2();
frmParent Parent = new frmParent();
Child2.MdiParent = frmParent.MdiParent;
Child2.WindowState = FormWindowState.Maximized;
Child2.Show();
foreach (Form childForm in frmParent.MdiParent.MdiChildren)
{
if (childForm != Child2) childForm.Close();
}
break;
But it didn't work.
|
|
|
|
|
I'm not 100% sure what you mean... can you be a bit more descriptive/specific?
Are you saying you want one MdiParent with child forms that can access each other? (Close each other etc)?
Matthew Butler
|
|
|
|
|
i have a problem with datagridview it's datasource is dataview
when i try to add new row in datagrid view it does not added
even i set allowusertoaddnew=true in dataview and datagridview
and this is my code
DV_Obligetory = DS_Subject.Tables["Subjects"].DefaultView;
DV_Obligetory.RowFilter = "Subject_Type='optional'";
DV_Obligetory.AllowDelete = true;
DV_Obligetory.AllowEdit = true;
DV_Obligetory.AllowNew = true;
BindingSource Binging=new BindingSource();
Binging.DataSource=DV_Obligetory;
Binging.AllowNew = true;
dg_obligatory.DataSource = Binging;
thnx 4 help
MD_NADA
|
|
|
|
|
This is not good. What makes you think your code is more deserving of help than any other poster here? You asked your question less than an hour ago, and now you're badgering people for help. This site is maintained by volunteers, who will get to your question when they have the time and inclination. If your question is really that urgent, then I suggest that you take it to somewhere where people get paid to answer your questions.
Deja View - the feeling that you've seen this post before.
|
|
|
|
|
i am so sorry , but i'm in need to know the answer importantly
this is the reason to ask again for the help
sorry for my way to ask
MD_NADA
|
|
|
|
|
Pete O'Hanlon wrote: You asked your question less than an hour ago
Just another impatient poster needing to have his posts ignored...
"Real programmers just throw a bunch of 1s and 0s at the computer to see what sticks" - Pete O'Hanlon
|
|
|
|
|
Hello everyone,
Something I've wondered about for some time: If I add a file (Any file, say Settings.Xml - I don't want to use MyApplication.Settings.XXX here) to my project in Visual Studio and I want to open it, how do I do this?
The following looks just plain awful:
Using X As New FileStream(Application.StartupPath & "/../../Settings.Xml", ...)
Since the startup path is /bin/debug/ this would work. But the moment I deploy my application somewhere, my Settings.Xml and executable should be in the same directory.
I could ofcourse put the files in the /bin/debug/ directory right away but that's not really elegant either is it.
Any ideas?
Cheers,
Wouter
|
|
|
|
|
Select the file in the Solution Explorer. Switch to the properties window. In the Copy to Output Directory dropdown select Copy Always.
Deja View - the feeling that you've seen this post before.
|
|
|
|
|
Yaye, that's it! Thanks Pete!
|
|
|
|
|
HI,
I've have a odbcDataAdapter
When i Drag&Drop it A wizard is Displayed
In The New Connection i Go To DataSource To Change it to odbc
but i do not have that option there.
i've got only :
Microsoft Access DataBase File
Microsoft Sql Server DataBase File
how can i add the odbc to the wizard???
i'm using MS Visual c# 2005 Express Edition
-- modified at 10:06 Wednesday 7th November, 2007
Have Fun
Never forget it
|
|
|
|
|
half-life wrote: i'm using MS Visual c# 2005 Express Edition
You can't.
"On one of my cards it said I had to find temperatures lower than -8. The numbers I uncovered were -6 and -7 so I thought I had won, and so did the woman in the shop. But when she scanned the card the machine said I hadn't.
"I phoned Camelot and they fobbed me off with some story that -6 is higher - not lower - than -8 but I'm not having it."
Tina Farrell, a 23 year old thicky from Levenshulme, Manchester.
|
|
|
|
|
i have a problem with datagridview it's datasource is dataview
when i try to add new row in datagrid view it does not added
and this is my code
DV_Obligetory = DS_Subject.Tables["Subjects"].DefaultView;
DV_Obligetory.RowFilter = "Subject_Type='optional'";
DV_Obligetory.AllowDelete = true;
DV_Obligetory.AllowEdit = true;
DV_Obligetory.AllowNew = true;
BindingSource Binging=new BindingSource();
Binging.DataSource=DV_Obligetory;
Binging.AllowNew = true;
dg_obligatory.DataSource = Binging;
thnx 4 help
MD_NADA
|
|
|
|
|
I have a dataset in my Smart Device Application. On my panel I would like to add buttons for the navigation of the records in my dataset (Previous and Next record).
Does anyone have an example of code for dataset navigation?
Thanks in advance.
|
|
|
|
|
Create your back and next buttons, and In your form load have a int set to 0(call this rowCounter). When next is pressed, increment that variable, and loop thru a row(your rowCounter) and get all your columns, and display them how you want. When back is pressed decrement the rowCounter variable, and loop through that row and do what you will with the columns
I get all the news I need from the weather report - Paul Simon (from "The Only Living Boy in New York")
|
|
|
|
|
hi all,
I have a listview in which i am trying to display thumbnail images along with text like the windows explorer.
I am able to display the thumbnail view with lots of help from members here. and i tried of sorting out the flickering problem in listview. but when i try to drag the vertical scrollbar down or up rather, the images are not aligned properly and it sort of is overwritten over one another.
here is the code i used for drawing the item(having set the owner draw property true).this is just a sample code with the controls having their default names.
private void listView1_DrawItem(object sender, System.Windows.Forms.DrawListViewItemEventArgs e)
{
if (imageList1.Images.Count > 0)
{
// Draw the item text for views other than the Details view.
if (listView1.View != View.Details)
{
//Image newimage = new Bitmap(imageList1.Images[e.ItemIndex]);
Image newimage = new Bitmap(imageList1.Images[0]);
left = e.Bounds.Left + 5;
top = e.Bounds.Y + this.Height / 7;
width = newimage.Width + 5;
height = newimage.Height - 25;
textbrush = new SolidBrush(Color.FromArgb(255, 236, 233, 216));
Rectangle text_rect = new Rectangle(left, top, width, height);
text = e.Item.Text;
DrawRoundedRectangle(e.Graphics, new Pen(textbrush), Color.White, text_rect, new Size(8, 8), newimage, text);
left = left + 20;
top = top + 130;
text_rect = new Rectangle(left - 5, top - 25, width - 30, 20);
DrawRoundedRectangle(e.Graphics, new Pen(new SolidBrush(Color.White)), Color.White, text_rect, new Size(1, 1), null, text);
listView1.EnsureVisible(e.ItemIndex);
}
}
}
public void DrawRoundedRectangle(Graphics g, Pen p, Color backColor, Rectangle rc, Size size, Image img, string text)
{
Point[] points = new Point[8];
//prepare points for poligon
points[0].X = rc.Left + size.Width / 2;
points[0].Y = rc.Top + 1;
points[1].X = rc.Right - size.Width / 2;
points[1].Y = rc.Top + 1;
points[2].X = rc.Right;
points[2].Y = rc.Top + size.Height / 2;
points[3].X = rc.Right;
points[3].Y = rc.Bottom - size.Height / 2;
points[4].X = rc.Right - size.Width / 2;
points[4].Y = rc.Bottom;
points[5].X = rc.Left + size.Width / 2;
points[5].Y = rc.Bottom;
points[6].X = rc.Left + 1;
points[6].Y = rc.Bottom - size.Height / 2;
points[7].X = rc.Left + 1;
points[7].Y = rc.Top + size.Height / 2;
//prepare brush for background
Brush fillBrush = new SolidBrush(backColor);
//draw side lines and circles in the corners
g.DrawLine(p, rc.Left + size.Width / 2, rc.Top,
rc.Right - size.Width / 2, rc.Top);
g.FillEllipse(fillBrush, rc.Right - size.Width, rc.Top,
size.Width, size.Height);
g.DrawEllipse(p, rc.Right - size.Width, rc.Top,
size.Width, size.Height);
g.DrawLine(p, rc.Right, rc.Top + size.Height / 2,
rc.Right, rc.Bottom - size.Height / 2);
g.FillEllipse(fillBrush, rc.Right - size.Width, rc.Bottom - size.Height,
size.Width, size.Height);
g.DrawEllipse(p, rc.Right - size.Width, rc.Bottom - size.Height,
size.Width, size.Height);
g.DrawLine(p, rc.Right - size.Width / 2, rc.Bottom,
rc.Left + size.Width / 2, rc.Bottom);
g.FillEllipse(fillBrush, rc.Left, rc.Bottom - size.Height,
size.Width, size.Height);
g.DrawEllipse(p, rc.Left, rc.Bottom - size.Height,
size.Width, size.Height);
g.DrawLine(p, rc.Left, rc.Bottom - size.Height / 2,
rc.Left, rc.Top + size.Height / 2);
g.FillEllipse(fillBrush, rc.Left, rc.Top,
size.Width, size.Height);
g.DrawEllipse(p, rc.Left, rc.Top,
size.Width, size.Height);
//fill the background and remove the internal arcs
g.FillPolygon(fillBrush, points);
if (img != null)
{
g.DrawImage(img, rc.Left + 15, rc.Top + 10, 80, 80);
}
else
{
StringFormat stringFormat = new StringFormat();
stringFormat.Trimming = StringTrimming.EllipsisCharacter;
stringFormat.FormatFlags = StringFormatFlags.NoWrap;
stringFormat.Alignment = StringAlignment.Center;
stringFormat.LineAlignment = StringAlignment.Center;
Rectangle text_rec = new Rectangle(rc.Left, rc.Top, rc.Width, rc.Height);
g.DrawString(text, f, new SolidBrush(Color.DimGray), text_rec, stringFormat);
}
//dispose the brush
fillBrush.Dispose();
}
can anybody tell me Where i am going wrong?
any suggestions on how to solve it?
Thanks in advance.
Regards
Anuradha
|
|
|
|
|
anu81 wrote: but when i try to drag the vertical scrollbar down or up rather, the images are not aligned properly and it sort of is overwritten over one another.
I didn't really look much thru the code, but here's what I suggest you try doing: In the listview events, find something for vertical scroll. When the event has finished, re-draw your images using the new coordinates of your object.
I get all the news I need from the weather report - Paul Simon (from "The Only Living Boy in New York")
|
|
|
|
|
anu81 wrote: Image newimage = new Bitmap(imageList1.Images[0]);
I assume imageListI.Images contains images, so why do you create a new Image here?
Can't you do just Image newimage = imageList1.Images[e.ItemIndex]; ?
Luc Pattyn [Forum Guidelines] [My Articles]
this months tips:
- use PRE tags to preserve formatting when showing multi-line code snippets
- before you ask a question here, search CodeProject, then Google
|
|
|
|
|
how we can create a datareader from a datatable. please suggest any way to solve this problem.
|
|
|
|
|
DataTable dt = new DataTable();
DataTableReader dr = new DataTableReader(dt);
I get all the news I need from the weather report - Paul Simon (from "The Only Living Boy in New York")
|
|
|
|
|