|
Can I use VStudio to design sleek looking windows applications, something like Google Chrome. If yes how?
|
|
|
|
|
Yeah you can, UI's can be tricky to design, but there is no reason why not if you put in enough effort.
humayunlalzad wrote: If yes how?
By coding.
|
|
|
|
|
You might want to use WPF if you want 'prettyness'
___________________________________________
.\\axxx
(That's an 'M')
|
|
|
|
|
|
suppose I have 3 functions.
1.
[CustomAttrib("First")]
public int Foo1(ref int x, out float y, SomeDelegate callback)
2.
[CustomAttrib("Second")]
public Stream Foo2(string name, SomeEnum enums);
3.
[CustomAttrib("Third')]
public void Foo3(string message, out double count, SomeStruct str);
Now what I want to do, is to validate each function according to their attribute. I want to create only one function named Validate which will validate all the above functions and then call them.
I tried to use delegate, lambda expression in Validate to pass the function, but nothing can get the attribute data.
I already tried :
public object Validate(Func<object> method) { .... } and call it as
Validate(() => Foo1(ref x, out y, DoCallBack));
or
public object Validate(Delegate method) { .... } & call it as
Validate(delegate() {return Foo2(null, SomeEnum.EnumValue); };
but none of them can get the attribute information of the called function
[Foo1, Foo2 etc.] in the body of Validate function.
Can anybody please suggest me any way-around to accomplish this task?
modified on Friday, May 22, 2009 12:32 AM
|
|
|
|
|
Hello,
I have datagrid in my application.
I want to create event that will be raised when datagrid columns were reordered by user (and then do something).
how can i do it?
|
|
|
|
|
Hi,
look for ColumnReordering and ColumnReordered events.
Luc Pattyn [Forum Guidelines] [My Articles]
The quality and detail of your question reflects on the effectiveness of the help you are likely to get.
Show formatted code inside PRE tags, and give clear symptoms when describing a problem.
|
|
|
|
|
there is no such event in events list of the datagrid.
What i want to do is after the user reorderes the columns (drag-drop column) the index of the moved column and the other will be changed according their new position. If i won't change the index- their index will be remaind as before even if the real position of the column is not as shown...
|
|
|
|
|
Sorry, WPF has it, WinForms does not.
Luc Pattyn [Forum Guidelines] [My Articles]
The quality and detail of your question reflects on the effectiveness of the help you are likely to get.
Show formatted code inside PRE tags, and give clear symptoms when describing a problem.
|
|
|
|
|
Hi
I am trying to POST some data to a webpage by using HttpWebRequest. But the webpage tells me that my security level is too high and I should check my browser settings.
How can I solve this? It is really urgent.
My code (if you need it):
Uri adres = new Uri("http://*********/****.asp");
HttpWebRequest request = (HttpWebRequest)WebRequest.Create(adres);
request.Method = "POST";
request.CookieContainer = new CookieContainer ();
request.CookieContainer.SetCookies(adres, webBrowser1.Document.Cookie);
string postData = "*********************";
byte[] byteArray = Encoding.UTF8.GetBytes (postData);
request.ContentType = "application/x-www-form-urlencoded";
request.ContentLength = byteArray.Length;
Stream dataStream = request.GetRequestStream ();
dataStream.Write (byteArray, 0, byteArray.Length);
dataStream.Close ();
WebResponse response = request.GetResponse ();
dataStream = response.GetResponseStream ();
StreamReader reader = new StreamReader (dataStream);
string responseFromServer = reader.ReadToEnd ();
StreamWriter sr = new StreamWriter(@"C:\Users\Admin\Desktop\response.html");
sr.Write(responseFromServer);
sr.Close();
sr.Dispose();
reader.Close ();
dataStream.Close ();
response.Close ();
Thanks in advance.
|
|
|
|
|
SimpleData wrote: It is really urgent
So?
SimpleData wrote: request.CookieContainer.SetCookies(adres, webBrowser1.Document.Cookie);
With the high IE security setting, you app can not create cookies.
Please remember to rate helpful or unhelpful answers, it lets us and people reading the forums know if our answers are any good.
|
|
|
|
|
My IE is not set to high security.
|
|
|
|
|
my code is here . what is the misstake ? it error when click on that button and message that "the object reference not set to an instand of an object". please give me some help
void Button_Click(object sender, EventArgs e)
{
Button clickedButton = sender as Button ;
if (clickedButton.Name == "Program")
{
MessageBox.Show("lkjd;lfjal;sdkjf;laksdjfl;jasd");
}
else
{
MessageBox.Show("dddddddddddddddd");
}
}
modified on Thursday, May 21, 2009 3:27 PM
|
|
|
|
|
Hi,
if that handler gets connected to an event of something other than a Button, then
Button clickedButton = sender as Button ; will set clickedButton to null.
You can take care of that by changing your code to:
...
if (clickedButton!=null && clickedButton.Name == "Program")
...
or by making absolutely sure only Buttons are being wired up to this handler.
FWIW: the fact that the handler's name starts with "Button" is fine for readability but does not change the way the code works.
Luc Pattyn [Forum Guidelines] [My Articles]
The quality and detail of your question reflects on the effectiveness of the help you are likely to get.
Show formatted code inside PRE tags, and give clear symptoms when describing a problem.
|
|
|
|
|
Are you sure the Button you are clicking on is a Button (and not some other control).
___________________________________________
.\\axxx
(That's an 'M')
|
|
|
|
|
my code is like bellow. but i don know the reason why it error? it message "Cannot assign to 'mnuItem' because it is a method group". please help me......
public DataTable mnuItem()
{
DataConnection dc = new DataConnection();
SqlConnection Cn = new SqlConnection(dc.ConnectStr);
SqlDataAdapter Da = new SqlDataAdapter();
DataSet Ds = new DataSet ();
DataTable Dt = new DataTable();
Cn.Open ();
SqlCommand Cmd = new SqlCommand("select ObjectID, ObjectName from _Objects where ObjectType='MENU' ", Cn);
Da.SelectCommand = Cmd;
Da.Fill(Ds, "_Objects");
Dt = Ds.Tables["_Objects"];
Da.Dispose();
Cn.Close();
mnuItem = Dt;
return mnuItem ;
}
|
|
|
|
|
You are assigning the function mnuItem the value of a DataTable. This would have worked in VB, but in C# you just need to use return Dt; . Incidentally, 'return mnuItem' would generate a StackOverflowException and a syntax error. Remove it
|
|
|
|
|
Additionally, the following line is pointless:
xingselex wrote: DataTable Dt = new DataTable();
Since you assign it later on to:
xingselex wrote: Dt = Ds.Tables["_Objects"];
This means you're creating an instance of a DataTable that is then discarded without use. Instead just declare it, or explicitly assign to null:
DataTable Dt;
or
DataTable Dt = null;
10110011001111101010101000001000001101001010001010100000100000101000001000111100010110001011001011
|
|
|
|
|
I think u just remove the last 2 lines. Then after Cn.Close(); write return Dt;
|
|
|
|
|
Hello.
I have a application, that does automative navigating of a webbrowser object..
I just often get the error:
"object reference not set to an instance of an object"
when the application is trying to get the html source or the lenght of a site, with this code:
if (webBrowser1.Document.Window.Frames[2].Document.Body.InnerHtml.Length < 5)
{
return true;
}
Even though I have functions that waits for the site to load done before continue it often occurs if the internet are a bit slow..
Is there anyway I can check if the object reference is set, or another way to solve this?
Hope there is help to find
|
|
|
|
|
Member 4417892 wrote: webBrowser1.Document.Window.Frames[2].Document.Body.InnerHtml.Length
Yuck. That code is beyond ugly. Split that up into separate variables, and look for one which is null. Are you just trying to get the page source?
|
|
|
|
|
if you want to make sure something isn't null, then perform a test against null
Luc Pattyn [Forum Guidelines] [My Articles]
The quality and detail of your question reflects on the effectiveness of the help you are likely to get.
Show formatted code inside PRE tags, and give clear symptoms when describing a problem.
|
|
|
|
|
Okay, so split it up in seperate variables, and afterwards check them for null?
so example:
if (webBrowser1 == null)
{
myLabel.Text = "Webbrowser is null";
}
And do that with all the objects i use for getting the source ?
|
|
|
|
|
Yes. Sooner or later you'll find the null variable. Do you just need to get the entire source code of a web page?
|
|
|
|
|
Yes I just need the entire source code, from the page the webclient browser is showing in the application..
I did this now, maybe that helps?
if (webBrowser1 == null)
{
write2log("Webbrowser object null error");
Wait(6000);
waitLoading();
}
if (webBrowser1.Document == null)
{
write2log("Webbrowser object null error 1");
Wait(6000);
waitLoading();
}
if (webBrowser1.Document.Window == null)
{
write2log("Webbrowser object null error 2");
Wait(6000);
waitLoading();
}
if (webBrowser1.Document.Window.Frames[2] == null)
{
write2log("Webbrowser object null error 3");
Wait(6000);
waitLoading();
}
if (webBrowser1.Document.Window.Frames[2].Document.Body.InnerHtml == null)
{
write2log("Webbrowser object null error 4");
Wait(6000);
waitLoading();
}
|
|
|
|