Class names not being highlighted. The projects all build, the solution builds, the only errors are html formatting errors that were there before this happened. The page still works, and the app still works, it's just that the IDE doesn't seem to recognize any of the references when I'm coding. When I write a using statement, it doesn't find any of my classes in intellisense. List<> is highlighted in light blue, but the classes in it are not. The class statement:
public partial class UserControls_SomeUserControl : System.Web.UI.UserControl
is NOT highlighted. public partial class is blue, but everything else is black, even UserControl.
If I hover over the using statements above, I get tooltips on all the references except for System.Web and anything below, as well as my own namespaces. And again, this is only on this one page in the app. I've actually had something like this happen before and I just remade the page to fix it. But I really don't want to have to do that everytime this happens. Tag: Visual C# General Help needed... Visual C#
generic error in gdi+ I am not sure, normally when you see a generic GDI+ exception it means the data is corrupt or there is some underlying stream that has been close too early.
I have some other code I use to capture the desktop, I have not seen this issue, you are more than welcome to try it out if you cannot figure out this issue: http://themightycoder.spaces.live.com/blog/cns!EBFBA22CD769E10B!133.entry
Mark. Tag: Visual C# General Help needed... Visual C#
Type Initializer Exception ! There's nothing wrong with initializing static fields where they are declared; and this is in fact the preferred method. This essentially creates a type initializer for you (static c'tor) with the code that initializes all the static fields at the start of it.
What could be happening is one of the field initializations doesn't play nice within a type inititilizer. Try removing all the initializations of your static fields and re-add them back in one-by-one until you get the problem again. (or the other way around, remove them one by one until the problem goes away).
Otherwise, if you can post the code that intiailizes all your static fields there might be something obvious to somoeone. Tag: Visual C# General Help needed... Visual C#
Using assignment in an if/while/ condition? Alright.. Thanks :)
I hadn't ever seen that before and wondered if it was something that was just generally frowned upon.. but its exactly how I need things so ill keep it in there.
Doing my first big commercial project.. for the government .. by myself.. im a little nervous lol
I don't see much of problem there, other than I'd rather use string.IsNullorEmpty
Didnt notice that one, thats very nice actually. I tend to use 0 length strings whenever I can mostly because I was doing alot of convoluted access apps where I found it much easier to just use empty strings.. I finally convinced the powers that be to get me some proper development tools and im slowly getting a pretty good feel for .NET Tag: Visual C# General Help needed... Visual C#
Application.Run() without showing the parsed form Evening all,
My question is can I have an System.Windows.Forms.Application.Run(MainForm) statement and execute it without having parsed MainForm visually appear. I have attempted to set properties such as Visible and methods like Hide() in the Form_Load event to no avail. It still shows the form.
//This is the class where i try and run my mainForm code
Trip_GenericWebBrowser _newGenericBrowserForm = new Trip_GenericWebBrowser ();
_newGenericBrowserForm.Controls.Add(_newBrowser);
_newGenericBrowserForm.Visible = false ;
_newGenericBrowserForm.Hide();
System.Windows.Forms. Application .Run(_newGenericBrowserForm);
//This is my form code
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
namespace TripJobber
{
public partial class Trip_GenericWebBrowser : Form
{
public Trip_GenericWebBrowser()
{
InitializeComponent();
}
private void Trip_GenericWebBrowser_Load( object sender, EventArgs e)
{
this .Visible = false ;
this .Hide();
}
}
}
Can anyone tell me why the form is still displaying
Thanks
Martin Tag: Visual C# General Help needed... Visual C#
opening other programs? Hello, is it possible with C# to open up the user's default internet browser and take it to a certain web page I would like it to open it outside the program (if you understand). If you can do this, is it possible to open any program Tag: Visual C# General Help needed... Visual C#
C#, try/catch blocks Hi!
Thanks for the reply! But when do you use try/catch blocks indestructors Example Tag: Visual C# General Help needed... Visual C#
ArrayList.IndexOf Because array list is generalized it compares the reference rather than performing the .Equals operation. ArrayList can technically have any object in it of any type, because each object is independant of the other objects you can have two items in ArrayList with different types ArrayList a = new ArrayList(); a.Add( 42 ); a.Add( "Something" ); a.Add( new Vector3( 0, 1, 0 ) ); now how do you suppose a.IndexOf( new Vector3( 0, 1, 0 ) ); is going to work with 42 with the string "Something" In order to be able to call .Equals on all items in the list, it has to be able to understand all types of objects. How are you going to compate Vector3( 0, 1, 0 ) to "Something" So, obviously it defaults to the object.Equals method which compares reference (location in memory) since you're declaring a new Vector3 to find the one inside the list, your memory locations aren't going to be the same. So the way you can get explicit compares is to use something that is typed. Since we now have (2.0+) generic collections, we can just form a typed collection with List<Type>. This will function like an ArrayList but maintain it's type information, and coincidentally call comparison operators from said type. Tag: Visual C# General Help needed... Visual C#
byte[] Array to Hex String thnx a lot, this work for me string hex = BitConverter.ToString(Bytes); hex = hex.Replace("-",""); although not "one-step" solution, but great enough Tag: Visual C# General Help needed... Visual C#
Running a console app from Windows Service It was just a guess, to be honest. I think your only other alternative is to throw some logging in a script or the service, and see how much of the time is actually spent inside the spawned process. That, or run it in the debugger and profile from there. Tag: Visual C# General Help needed... Visual C#
VC# Express crash with form designer Hey, I found a workaround for my problem, not really a solution though. My control loads a few resources when it is initialized (volume texture, shader and conventional texture) so i can see if any code changes have the desired effect without having to load the resources manually. I commented out the lines of code that were responsible for loading these resources (from file btw, not embedded), and the Form Designer works without crashing which is great. As mentioned above this is not really a solution because I have to comment out those lines of code to be able to use the Form Designer and uncomment them after I'm done to run my solution properly. Hope this is helpful to someone, but it would be nice if a real solution exists. Paul <edit> Slightly better workaround: removed the resource loading code from the control's constructor and instead wait for the control to be loaded before calling the resource loading routine. No need for commenting/uncommenting this way.. Tag: Visual C# General Help needed... Visual C#
C# and Adobe PDF Reader Hi,
Look, I'm not an expert, but I don't think its a C# issue either. It may work (try it, but I wouldn't know myself) if you got hold of a very early version of Adobe Acrobat Reader 3 or 4, and found the AcroPDF.dll for that application and used that instead of the Adobe Reader 8.
Hope this helps.
Eragon. Tag: Visual C# General Help needed... Visual C#
Unable to copy vshost.exe after publish I gues it is coused by that your application is still running. Try to look Proceses. Tag: Visual C# General Help needed... Visual C#
Building Deployment projects from the command line (devenv.exe) Hey, I have a need to build a single deployment project from the command line using devenv but I have a need not to rebuild any dependant projects in its solution (ie when the deployment project take the output of another solution I want so assume that this is already built). Is this at all possible James Tag: Visual C# General Help needed... Visual C#
C# Delegate Method Reflection Capabilities PREAMBLE Thank You for such a quick and comprehensive response. My <thoughts> were just specifics for my problem .. I could have stated that The <thoughts> were not intended to be exhaustive explanations. CORE The documentation for C# for delegate writes (elided) Delegate.Method Property Property Value A MethodInfo describing the method represented by the delegate (note the capital M)
So it may be easy to confuse in this note the notions of general <method> ... and Delegate.Method Property I will assume at some point in your response you meant Delegate.Method Property or sibling methods Thanks for inspiring me to examine those methods/properties more closely.
PRIMARY QUESTION (repeat) Can one get a unique id from a method name in the C# language ANSWER Substantially yes or very usefully close once a delegate is created with the method then one can get the method name and much more with <Delegate.Method Property >
SAMPLE C# sb.Append(" Reflection"); System.Reflection.MethodInfo mi_q = cp.comparison_imp.Method; sb.Append("["); sb.Append(mi_q.Module.Name); sb.Append("]"); sb.Append(mi_q.DeclaringType.Name); sb.Append("."); sb.Append(mi_q.Name); sb.Append(" Target "); sb.Append((null == cp.comparison_imp.Target) "None" : cp.comparison_imp.Target.ToString());
TEXT excerpt copied from text visualizer in VS2005 "Reflection[discrete.exe]person_sequence.comparison_birth_date Target None"
THANKS
............................... SOME SECONDARY NOTES
The keyword ... event ... is <NOT> used directly in the body of software about which I am writing. Moderately interesting is that keyword .. delegate .. is not in the software I wrote. I am simply using the delegate declared in the System namespace .. Comparison<T>.
The software is functioning correctly and simply does a multifield sort on some data. The methods are encapsulated by delegate only (no event). The particular methods to be used are dynamically selected. This is a software sample
public class cda<T> //generic { //elided explanatory not necessarily ready for compiler public Comparison<T> comparison_imp;//Systems Namespace ..Generic delegate public string name_imp;//used to produce a humanly readable audit trail } //a list of these are used subsequently public List<cda<person_c>> cs = new List<cda<person_c>>(); list_q.Sort(csq.compare_sequence); Tag: Visual C# General Help needed... Visual C#
static method - Is there any workaround? Okay, let's put it this way. We have an interface that requires a static method. Who exactly is going to implement that method Every class that implements the interface Of course not, because then it wouldn't be static would it Would it perhaps require that one implemented it If so, are we talking one implementation per assembly What happens if we reference an assembly that already has it implemented Would we have to provide a mechanism to override the static If so, since there is no hierarchy, and all implementations are on the same level as it were, how would we do that
Why on earth would we even attempt to resolve these issues and questions (if they are even solvable) if there is no need for this Frankly, your example is screaming for the abstract factory pattern, not for a whosesale reevaluation of how interfaces work. Tag: Visual C# General Help needed... Visual C#
How to convert PDF to TIFF through C#? i also have the same problem, when fax pdf file\
anyone can solve, can share with me
email:
hajor#msn.com Tag: Visual C# General Help needed... Visual C#
Finalize and Dispose That code looks fine to me. What does your test look like Why do you think Finalise should be called multiple times Tag: Visual C# General Help needed... Visual C#
For unmanaged code: Does Operating System translate specific OS codes into machine code? john wen wrote:
Is COM object implemented in machine code Or is COM object implemented in specific Operating System code John Wen 4 - July - 07 Depends on the object. An object can be implemented in whatever programming language a user sees fit. That could be C++, C#, VB, assembler, etc.
There's no such thing as "operating system code" when implementing a COM object. Do you mean a specific Operating System's API Tag: Visual C# General Help needed... Visual C#
What does this bit of code do? To add to what the others said: Having an "indexer" for a class means that you can access items in an instance of that class as if it were an array: MyClass myClass = new MyClass(...) ... myClass[1] = ... // Access it as if it were an array. Tag: Visual C# General Help needed... Visual C#
Accessing enclosing class members from a nested class. Yes it is harsh but I haven't run across a situation where a protected nested type is useful. Nested types are implementation details so they are irrelevant to everybody else (including derived types). Derived types should access the nested type through either a non-nested base type class or an interface exposed as a protected property. Otherwise you can't change the implementation without potentially breaking a derived type. IMHO.
Michael Taylor - 9/25/07
http://p3net.mvps.org Tag: Visual C# General Help needed... Visual C#
How to Enumerate StringBuilder object with null character as delimiter between strings thanks for your reply.
the code i used is as follows
**************///code for importing GetPrivateProfileSection() method///**************************
[ DllImport ( "kernel32" )]
private static extern int GetPrivateProfileString( string section,
string key, string def, StringBuilder retVal,
int size, string filePath);
**************///code for reading .ini file //**************************
StringBuilder temp = new StringBuilder (1024);
int i = GetPrivateProfileString( "exch2000-gate" , null , "" , temp,
1024, "C:\\randhir\\fpadmin\\FPUserList.ini" );
string str = temp.ToString();
my aim is to enumerate key names of a specified section "exch2000-gate". in my above code temp is stringbuilder conating of all key value names. you may advise to use GetPrivateProfileSection() method to retrieve key names and their values. but by giving "null" as a second parameter i can enumerate key names to a specified buffer temp.
i reffered the following link for my code.
http://msdn2.microsoft.com/en-us/library/ms724353.aspx
thanks and regards
ranadheer. Tag: Visual C# General Help needed... Visual C#
const values accessible in namespace? Also,
you could define the value as a const i.e. public const int x; since consts are also trated as static variables, however they do have one difference to static variables in that the actual value of the const variable is replaced in the code where it is called from, so if you define a const value in assembly A then reference that value in assembly B, if you change the value of the const in assembly A you will have to recompile assembly B again otherwise it will still have the old value.
Mark. Tag: Visual C# General Help needed... Visual C#
How CLR can call Finalize as it is a protected method Yes, the CLR certainly doesn't use reflection to invoke the finalizers. Since the CLR is managing the vtables of methods for object, it inherently has access to that information. I was was just trying to show that being "protected" doesn't really offer a strict access guarantee. Tag: Visual C# General Help needed... Visual C#
Singleton as startup Are you aware that you can just call Application.Run(); with no parameters at all
The application will then run for as long as you want - until you call Application.Exit(). The idea of there being a 'main form' is convenient for single-window applications, but if that pattern doesn't suit you, you're not obliged to use it. And it sounds like you want to do something different from the normal pattern.
You're allowed to modify the code in program.cs. Why not just modify that code to ensure that your singleton is created, and create whatever forms you want in there
The singleton pattern is something you just go ahead and implement - you don't need to fit into some Windows Forms-specific way of doing it. Just implement it as normal. You take control of Windows Forms - you don't need to let it dictate terms to you. Tag: Visual C# General Help needed... Visual C#
Conversion of DateTime to FILETIME hi,
I need to convert a date time value to file time, i tried this ....
FILETIME ft = new FILETIME ();
//from System.DateTime to System.Runtime.InteropServices.ComTypes.FILETIME
/////////////////////////////////////////////////////////////////
long hFT1 = DateTime .Now.ToFileTime();
ft.dwLowDateTime = ( int )(hFT1 & 0xFFFFFFFF);
ft.dwHighDateTime = ( int )(hFT1 >> 32);
/////////////////////////////////////////////////////////////////
in order to check that conversion is right I converted file time back to date time using this code ...
/////////////////////////////////////////////////////////////////
//from System.Runtime.InteropServices.ComTypes.FILETIME to System.DateTime
/////////////////////////////////////////////////////////////////
long hFT2 = ((( long )ft.dwHighDateTime) << 32) + ft.dwLowDateTime;
DateTime dte = DateTime .FromFileTime(hFT2);
but this 'dte' is a wrong value.
i think the problem is : FILETIME.dwLowDateTime is a signed int and if 32nd bit of long value is '1' , the FILETIME.dwLowDateTime is converted to negative value.
PLz help me for correct conversion of datetime to filetime.
Regards, Tag: Visual C# General Help needed... Visual C#
List<> casting Mike Danes wrote: List<T> implements IList so you can just cast to IList. In addition arrays also implement IList so you can just write:
if ( value != null ) {
IList list = value as IList;
if (list != null && list.Count > 0)
SelectedObject = list[0];
} Thak you, its work perfect! You is my new hero =] frederikm wrote: Hi
could you not implement your class as being generic
also, why are you using object for your dataSource
class test<T>{
(...)
}
}
granted, you lose the setter of the property, but it's somewhat more generic...
Hi, your solution is a ideal, but, SelectedObject is a object from
other component (DevExpress). In all my forms i setting the property
DataSource. If my DataSource is a object, i dont¡¯t have to re-implement
all my forms now...
Ps: Sorry, my english is bad. If you don¡¯t understand i can try explain this again.
Thank you Tag: Visual C# General Help needed... Visual C#
How can i handle Exception If error occured in Thread? It depends on the type of thread. Unhandled exceptions on some threads are simply swallowed and you'll never be informed. Asynchronous delegates are a good example. Methods using the .NET 1.x asynchronous pattern (BeginXXX/EndXXX) are another; any unhandled exceptions will be swallowed until the call to EndInvoke (if you don't have an EndInvoke the exception never propagates to ThreadException or UnhandledException).
I would question why you want to handle thread exceptions in this way. If it's to inform the user somehow; you really have no way of knowing if the UI is capable of providing information to the user (ThreadException and UnhandledException handlers are called on the thread that caused the exception). Tag: Visual C# General Help needed... Visual C#