|
What gets returned if the catch executes?
Answer that and you have the answer to your question.
|
|
|
|
|
The reason you're getting this error, is that not all code paths will return a value. The best thing to do is to declare an instance of the return type at the top, with a default value, set that value in the rest of the code, and return it at the bottom.
What do you want it to return if the method throws an exception ? Why do you have a generic try/catch here at all, what errors are you anticipating, and if they are written to the console, who will see them ? What will the rest of the code do if an error is caught and swallowed here, just try to soldier on ?
Christian Graus - Microsoft MVP - C++
"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 )
|
|
|
|
|
I have a web site which should be accessed by the user within the organization and user from outside through Internet.......Now how can i know who is accessing the web site........I have different access previlages for both........
How can i achieve this using asp.net2.0
Plz help me
|
|
|
|
|
I don't know if it is possible in ASP.NET but I would examine the IP address of the person who is accessing the website.
|
|
|
|
|
Hi,
I have a form with a button1 click event. Now, I need to have a different button2 on the form but the functionality should be of button1. So, I need to call button1_click event from button2_click event.
The below code works. But I need the event args not empty. Can you suggest some idea?
protected void Button1_Click(object sender, EventArgs e)
{ TextBox1.Text = "test"; }
protected void Button2_Click(object sender, EventArgs e)
{Button1_Click(null, EventArgs.Empty );}
|
|
|
|
|
That works, but if you want to pass on the args, why not pass on e ? And, isn't the default event args devoid of anything useful ?
A more intelligent design would be to factor the code in button1_click to a method that all click events call, or just point all buttons to the one event. I assume this is just sample code, by the dumb variable names, so there may be complications with having one event, but one common method is always good.
Christian Graus - Microsoft MVP - C++
"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 )
|
|
|
|
|
First of all, you can have the same event handler for both of the buttons. If you are using VS 2005, you can choose the event handler for button2 from dropdown list of event handlers at the click event. You can also specify the same event handler like this:
<br />
this.Button1.Click += new System.EventHandler(this.Button1_Click);<br />
this.Button2.Click += new System.EventHandler(this.Button1_Click);<br />
Secondly, EventArgs doesn't have any properties that carries any useful information so what do you need instead of EventArgs.Empty ? If you need any additional properties you can write you own class that inherits from EventArgs and extends its functionality
|
|
|
|
|
|
I've developed a Crystal Reports, and when exported to PDF, it looks great. It even looks great (to me) when exported to excel. However, one of the business users is stating they have an issue with it. Since some of the cells that are being used are wider than the default for excel it is merging the cell with data with the cells around it, and centering the data in the merged cells. Does anyone know how to tell it I don't want it to do this?
|
|
|
|
|
When exporting Crystal Reports to Excel, I have found these general rules help:
1. Use Guidelines extensively to ensure all fields are perfectly aligned vertically.
2. Avoid using Center alignment in fields.
3. Fields cannot overlap one another, otherwise extra rows will result in the spreadsheet.
HTH!
Sincerely,
-Mark
mark@msdcweb.com
http://www.msdcweb.com
|
|
|
|
|
Hi there!
I need something visio-like for our upcoming delphi project conversion. All I found so far is VG.NET. But it is design-time editor. I am looking for run-time.
Any advices?
Thanks.
|
|
|
|
|
You're converting Delphi to C# ? Is it Delphi.NET ? Sounds like a rewrite to me....
Christian Graus - Microsoft MVP - C++
"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 )
|
|
|
|
|
Yup. Convert - is in fact rewrite.
Project itself is not a vector editor. It's more like Infopath with additional features (one of which is user editable sketches). I was thinking about Ink, but there is a requirement for regions, filled shapes and so on.
Here is what I have in mind (only for .NET WinForms)
http://www.ksdev.com/blockengine/screen.html[^]
|
|
|
|
|
Looks like a lot of fun.
Christian Graus - Microsoft MVP - C++
"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 )
|
|
|
|
|
Why not take a look at this[^]? You can also find a version of Netron on Sourceforge called Netron Unloaded.
Deja View - the feeling that you've seen this post before.
|
|
|
|
|
I developed a drawing program.
I use GraphicsPath, now i wantto erase what i drawn. how could i do.
Drawing code is above.
Dim mousePath As New System.Drawing.Drawing2D.GraphicsPath()<br />
Dim SelectRect As New Rectangle()<br />
Dim ps As New Point()<br />
Dim pe As New Point()<br />
Private Sub PictureBomcp1_MouseDown(ByVal sender As Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles pbImage.MouseDown<br />
SelectRect.Width = 0<br />
SelectRect.Height = 0<br />
SelectRect.X = e.X<br />
SelectRect.Y = e.Y<br />
ps.X = e.X<br />
ps.Y = e.Y<br />
pe = ps<br />
If e.Button = Windows.Forms.MouseButtons.Left Then<br />
mousePath.StartFigure()<br />
End If<br />
<br />
End Sub<br />
<br />
Private Sub PictureBomcp1_MouseMove(ByVal sender As Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles pbImage.MouseMove<br />
If (e.Button = MouseButtons.Left) Then<br />
Dim thisform As PictureBox = CType(sender, PictureBox)<br />
Dim g As Graphics = thisform.CreateGraphics()<br />
mousePath.AddLine(e.X, e.Y, e.X, e.Y)<br />
g.DrawPath(New Pen(MyConstants._C, MyConstants._W), mousePath)<br />
End If<br />
End Sub<br />
<br />
Private Sub PictureBomcp1_MouseUp(ByVal sender As Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles pbImage.MouseUp<br />
Dim thisform As PictureBox = CType(sender, PictureBox)<br />
Dim g As Graphics = thisform.CreateGraphics()<br />
Dim p As New Pen(MyConstants._C, MyConstants._W)<br />
g.DrawPath(New Pen(MyConstants._C, MyConstants._W), mousePath)<br />
mousePath.Reset()<br />
g.Dispose()<br />
End Sub
|
|
|
|
|
May I suggest looking at these articles on CodeProject for good ideas on drawing programs:
Draw Tools[^]
Draw Tools Redux[^]
The second article is an extension of the first, both illustrate drawing objects, resizing, erasing, moving, saving to and restoring drawings from disk, etc.
Sincerely,
Mark
mark@msdcweb.com
http://www.msdcweb.com
|
|
|
|
|
Hi again,
I aim to do a simple eraser for deleting what i draw as mspaint.
I searched CodeProject for erasing code, but i couldnt find.
|
|
|
|
|
In that case, you wouldn't want to use a GraphicsPath to do the drawing, instead just draw on your canvas and implement the erasing code by drawing over existing objects with the background color, which is what MSPaint does.
Sincerely,
-Mark
mark@msdcweb.com
http://www.msdcweb.com
|
|
|
|
|
i would do so if not i didnt draw on %50 opac canvas :S
|
|
|
|
|
How do i sort a listviews items for what i whrite in a textbox that it only will show thoose items??
Love take care!!![D'Oh! | :doh:](https://codeproject.global.ssl.fastly.net/script/Forums/Images/smiley_doh.gif)
|
|
|
|
|
andredani wrote: How do i sort a listviews items
Do you know how to sort a listview? If not do some searching there must be a million sources that show how to do it.
However if this is your problem:
andredani wrote: for what i whrite in a textbox that it only will show thoose items??
I have no idea what that means
|
|
|
|
|
hi all,
I am using a datagridview to display data.i am creating a datatable dynamically and set it as a datasource. i am contatenating values of two columns and displaying in a single column. i need to highlight one of the values as a bold text.
i am using VS 2005 with C#.net in windows application.
How can i implement the same?
Thanks in advance.
Regards
Anuradha
|
|
|
|
|
Handle the DataGridView's CellFormatting Event and write code to change BackColor of the value of want to Highlight.
|
|
|
|
|
This is my code to save something from a textbox:
StreamWriter msgStreamWriter = new StreamWriter("message.txt");
msgStreamWriter.WriteLine(textBox1.Text);
msgStreamWriter.Close();
is it possible to save different messages and also in different files?
for example,
message1 into notepad1
message2 into notepad2
message3 into notepad3
help please!
Thanks.
|
|
|
|