|
I opened in vs and tried to add new project, but visual C# shows only windows and office types, how can I add a web app as the project?
I created the web app sln by going through File->New Website because file->project does not show web application at all.
Please help
|
|
|
|
|
I built a custom control 'ChooseBox' that inherits from ComboBox. When I select an item from a choosebox control, the text in the textbox cannot be seen because of the blue selected text color. If I click away, the selected text is there. I can't see anything wrong with my code. I know this is probably a simple q. Here is the code. Can anybody help?
arevans
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Drawing;
using System.Data;
using System.Text;
using System.Windows.Forms;
using UtilityCode;
namespace WindowsControlLibrary
{
public class ChooseBox : ComboBox
{
public ChooseBox()
{
this.CausesValidation = true;
this.GotFocus += new EventHandler(ChooseBox_GotFocus);
this.LostFocus += new EventHandler(ChooseBox_LostFocus);
this.DropDown += new EventHandler(ChooseBox_DropDown);
this.Font = new Font("Andale Mono", 11F, FontStyle.Regular);
} // constructor
void ChooseBox_GotFocus(object sender, EventArgs e)
{
this.BackColor = Color.Yellow;
this.Font = new Font(this.Font, FontStyle.Bold);
} // method: GotFocus
void ChooseBox_LostFocus(object sender, EventArgs e)
{
this.BackColor = Color.White;
this.Font = new Font(this.Font, FontStyle.Regular);
} // method: LostFocus
protected override bool ProcessCmdKey(ref Message msg, Keys keyData)
{
bool retValue = base.ProcessCmdKey(ref msg, keyData);
const int WM_KEYDOWN = 0x100;
const int WM_SYSKEYDOWN = 0x104;
if ((msg.Msg == WM_KEYDOWN) || (msg.Msg == WM_SYSKEYDOWN))
{
switch (keyData)
{
case Keys.Down:
SendKeys.Send("{TAB}");
retValue = true;
break;
case Keys.Up:
SendKeys.Send("+{TAB}");
retValue = true;
break;
case Keys.Enter:
SendKeys.Send("{TAB}");
retValue = true; // setting retValue =true here prevents a beep
break;
}
return retValue;
} // method: ProcessCmdKey
void ChooseBox_DropDown(object sender, EventArgs e)
{
this.BackColor = Color.White;
this.Font = new Font(this.Font, FontStyle.Regular);
}
}
}
|
|
|
|
|
You could override the OnPaint method, and check to see the bounds of the selected item, then redraw the text using a white font after base.OnPaint is done. I don't see any more obvious way to accomplish that, but let us know if you find one.
Jeff
|
|
|
|
|
I cannot seem to figure it out. The default value is not working because it still comes up in bold in the property window.
private System.Collections.ArrayList _Test;
[DefaultValue(null)]
[Editor(typeof(TestCollectionEditor), typeof(System.Drawing.Design.UITypeEditor))]
[System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Usage", "CA2227:CollectionPropertiesShouldBeReadOnly")]
public System.Collections.ArrayList Test
{
get
{
if (_Test == null)
_Test = new System.Collections.ArrayList();
return _Test;
}
set { _Test = value; }
}
I have tried....
[DefaultValue("")]
[DefaultValue(-1)]
Chris
|
|
|
|
|
What is it you want to happen? Not show up bolded in the properties window of Visual Studio? Or not show up at all in the Visual Studio properties window?
|
|
|
|
|
I dont want it to show up in bold.
|
|
|
|
|
I have a simple site allows someone to register to download a help file. It has 3 pages:
The main page has the form fields, with a button for submitting that has an onclick event.
The code behind page has the onclick code for the button click. Once this processes, it forwards to the download page.
the Download page has a clickable link to download the pdf file.
Simple, right? ... Well the problem is, if the user hits the back button from the download page, the Click event is still active and the registration code runs again, then redirects back to the download page.. so the user hits back again.. and the loop continues... I have ended up with 8-10 copies of a user.
so I guess I need to clear the click event after processing the registration, before the redirect. But I have been having trouble finding information on how to do this? Is there a quick and easy fix that I am overlooking?
thanks
Sam
|
|
|
|
|
Why don't you just make a link on the registration page that leads to the main page? So if the user wants to go back, they can click that link.
Admitted, the other solution would be better, but this one is very simple and quick to make.
- Virtual1ty
--
"Any fool can learn from his own mistakes, but a wise man learns from mistakes of others"
|
|
|
|
|
The easiest way is to redirect your page to itself. That resets the viewstate, so that going back doesn't cause a refresh of the page load that sent the click event to the code behind.
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'm not positive what you mean. How do I get to the download page if I am redirecting back to the default page? i could add a query string and check that, I suppose and then forward to the download page, but it seem like an odd way to move through what should be a straight forward pageflow...
|
|
|
|
|
There are several ways to do it. One possiblity is to set a persistent cookie on the download page. In the page load event of the registration page, check for the cookie, if it is there, send them to the download page. Then if they come back to the registration page tomorrow or next week, they will be sent along to the download page (assuming it is not a secure page).
|
|
|
|
|
Hi All ,
I think the solution for this problem is simple.. But I am unable to get one.
Can you please help me .
The Following code Shows an error: Not All Code Paths Return A Value
public TestCaseDataSet.TestCaseDataTable GetTestCaseSimpleFilterResults(List<int> TestCategories, List<int> Printers, List<int> OsAllowed,List<int> runOs, List<int> Platform,List<int> Status, string BeginRunDate, string EndRunDate)
{
try
{
return mngTestCase.Get_TestCases_ByMasterFilter_01_StronglyTyped(TestCategories,Printers,OsAllowed,runOs,Platform,Status,BeginRunDate,EndRunDate);
}
catch (Exception ex)
{
Console.WriteLine("Error" +ex.Message);
}
}
GetTestCaseSimeFilterResults is the funtion that it is happenning for.
Please help me out,
Thanks
Nikhil Pagidala
Happy Programming!
Regards,
Nikhil Pagidala
|
|
|
|
|
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[^]
|
|
|
|