Vijay Chegu's Q&A profile
Visual C# Best way to achieve this?
I need to run a loop to check if a file exists then delete it. Once its deleted it can stop looking. However, at the time the loop starts it may not exist, but it will evntually be created. do { delete(); Console.WriteLine("Checking"); } while (check() == false); private static bool check() { if (File.Exists(Environment.GetEnvironmentVariable("SystemRoot") + @"\myfile.dat")) return true; return false; } public static void delete() { if (File.Exists(Environment.GetEnvironmentVariable("SystemRoot") + @"\myfile.dat")) { File.Delete(Environment.GetEnvironmentVariable("SystemRoot") + @"\myfile.dat"); Console.WriteLine("Deleted"); } } >> If you dont include braces in an if statement, the firs ...Show All
Software Development for Windows Vista Problems with WMI classes Win32_VideoController, Win32_VideoSettings, and CIM_VideoControllerResolution under Vista.
Under Vista, attempts to access Win32_VideoSettings and CIM_VideoControllerResolution objects via WMI return no records. The online documentation claims that Vista is a supported platform. The Win32_VideoController object returns records but all the CurrentBitsPerPixel, CurrentHorizontalResolution, CurrentNumberOfColors, CurrentRefreshRate, CurrentVerticalResolution, etc., are all empty. Further, the Availability value for every controller is set to 8, (OffLine). I'm having no problems obtaining WMI information from Vista, exactly like that under XP, except for the three that I mentioned. Is this a bug under Vista, or has the information moved somewhere else The information has not moved. These are ...Show All
SQL Server Reporting Services 2005 and Business Logic
I'm working on a app with complex reporting requirement and would like to centralize the business logic for app and reporting. We are not planning to use SP for reporting. Having said that, i would ideally like the reports call the business layer (business.dll) assembly which in turn will call the data access layer (data.dll) assembly to run the required queries and get the results via business assembly as a custom business entity or data set. I'm not sure if this possible with Reporting Services 2005. I have looked at the custom data processing extensions but i dont think it will provide me the required business-data separation unless i'm missing something. I was wondering if anyone has done this before and if yes, could you please pro ...Show All
Windows Forms repro case
Hi When I run my .NET 3.0 ClickOnce app on Vista RTM, nothing happens. I'll click launch, but I never see the initial UI screen or any errors, nothing at all. Is there a way to view a ClickOnce error log *edit* here's a repro case: http://judahhimango.com/test Can anyone please try this Click the link above and tell me if it's working I've only got 1 Vista machine to try it on, and it's not working on that one; I need to isolate the problem, and testing on multiple Vista machines would really help at this point. ...Show All
.NET Development SMTPMAIL error (bare LF)
Hi I got this error went using SMTPMAIL, "System.Web.HttpException: Could not access 'CDO.Message' object. ---> System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation. ---> System.Runtime.InteropServices.COMException (0x80040211): The message could not be sent to the SMTP server. The transport error code was 0x800ccc6a. The server response was 451 See http://pobox.com/~djb/docs/smtplf.html." Can someone on how to end the email Thanks in advance. Yap, I follow the link. It say the mail server require the email to end with CR LF dot CR LF. I only facing problem with this particular mail server. this is my script MailMessage msg = new MailMessage ...Show All
Game Technologies: DirectX, XNA, XACT, etc. PIX crash when attempting to set shader variable
I've got some code that works fine when not running via pix, how ever when i run it through pix it crashes. I've found that the crash is caused when i call either: SetResource or SetMatrix here is my code: void DX10Effect::SetTexture(EffectParamHandle handle, Texture* texture) { HRESULT hr = ((ID3D10EffectShaderResourceVariable*)handle)->SetResource( static_cast <DX10Texture*>(texture)->GetTextureRV()); int nothing = 0; } void DX10Effect::SetMatrix4(EffectParamHandle handle, const Matrix4& matrix) { HRESULT hr = ((ID3D10EffectMatrixVariable*)handle)->SetMatrix(( float *)&matrix); int nothing = 0; } EffectParamHandle is typdef'ed as a void* so hr = S_OK when ...Show All
Visual C# adding single quotes
Does anyone know how to add a single quote character in the subject line of an email like this "hello 'XXX YYY' " I've tried every thing, escaping a character, character entities etc but all in vain. Please help. Any suggestion would be greatly appreciated. Thanks in Advance Shine Try this: "hello \'XXX YYY\' " Put a slash before ', during compilation, comiler will see slash and will ignore it because its an escape sequence in C#. Best Regards, Rizwan ...Show All
SQL Server How can I catch all errors of the stored at the same time?
I have a stored prcedure . In the stored I wrote 3 SQL statements, one is OK but 2 other statements have error as: 1. Invalid column name 'F2' 2. Invalid object name '##_152008049' . I put the stored inside try block and catch error in catch block as the following. But I always catch only the first error : invalid column name F2 . How about the second statement How can I catch all the errors when I put the stored in try block. Now I don't want to add try..catch inside the store for each statement. Begin try exec mystored End try begin catch ERROR_NUMBER () AS ErrorNumber , ERROR_SEVERITY () AS ErrorSeverity , ERROR_STATE () as ErrorState , ERROR_PROCEDURE () as ErrorProcedure ...Show All
Visual C# MessageBox question -->
This is what I have: private void Form1_FormClosing( object sender, FormClosingEventArgs e) { if (e.CloseReason == CloseReason .UserClosing) MessageBox .Show( "Are you sure you want to exit " , "User Closing Warning" , MessageBoxButtons .YesNo, MessageBoxIcon .Warning, MessageBoxDefaultButton .Button2); } But, how do I make it so that when the user click yes, the App exits and when the user clicks no, the App doesn't do anything to make the app not close, set the e.Cancel = true; and to make the app close, set e.cancel = false; example: DialogResult theUserResult = MessageBox .Show( "Exit " , "Exit Application " , MessageBoxButtons .YesNo); if (theU ...Show All
Visual Studio Team System Running the load agent at remote sites
Hi, I'm currently evaluating Visual Studio Tester edition and have a question about licensing. Quite often I need to run load tests at client sites on their hardware. If I get a couple load test agents, can I uninstall from my local setup and install at client sites for testing Thanks, Cliff Thanks for getting back to me David. I've actually already gone through this document and cannot find an answer to my question. Do you have any other ideas as to where I might find more info on this Thanks, Cliff ...Show All
Visual C# panel.visiable's problem..I've to double click then it works
// in my webpage I put my controls in a panel , when page load I set panel.visable = false. only when botton_click and then panel.visable=true //my problem is panel doesn't appear when I click once. I've to double click and then panel become visiable.. what's going wrong is my problem concern with "post back " I've no idea... P.S... I write panel.visiable while datareader.read() thanks Thank you for replies. The panel visible cannot make it behave that way. So, it's not panel problems. It must be other codes' issue...Could you give the code to find what went wrong ...Show All
SQL Server ADO.NET cannot connect to SQL2k, but Query Analyzer does
I have an ADO.NET (.NET 2.0) application that throws a connection exception when trying to connect to a SQL 2000 Standard server (despite what the message says about 2k5, which I assume is generic): System.Data.SqlClient.SqlException: An error has occurred while establishing a connection to the server. When connecting to SQL Server 2005, this failure may be caused by the fact that under the default settings SQL Server does not allow remote connections. (provider: Named Pipes Provider, error: 40 - Could not open a connection to SQL Server) at System.Data.SqlClient.SqlInternalConnection.OnError(SqlException exception, Boolean breakConnection) at System.Data.SqlClient.TdsParser.ThrowExceptionAndWarning(TdsParserStateObject stateObj) at ...Show All
Visual Basic How to log print jobs?
Hello kind friend. i have this script from the repository, strComputer = "." Set objWMIService = GetObject("winmgmts:" _ & "{impersonationLevel=impersonate}!\\" & strComputer & "\root\cimv2") Set colPrintJobs = objWMIService.ExecQuery _ ("Select * from Win32_PrintJob") Wscript.Echo "Print Queue, Job ID, Owner, Total Pages" For Each objPrintJob in colPrintJobs strPrinter = Split(objPrintJob.Name,",",-1,1) Wscript.Echo strPrinter(0) & ", " & _ objPrintJob.JobID & ", " & objPrintJob.Owner & ", " _ & objPrintJob.TotalPages Next it reads ...Show All
Game Technologies: DirectX, XNA, XACT, etc. standalone content pipeline
Hellow guys! I need to create a ContentPipeline object away from xna framework class Game. Do you know a way to make this thanks! Shinji Microsoft Student Partner I too wrote a control that creates a device and whatnot ... it supports loading content pipeline files: codecube .net/item.asp cc_itemid=338 Basically, you just have to implement the IServiceProvider, and pass the instance of the class that implements it into a ContentManager ...Show All
Visual C++ Weird problem with _wopen() : errno = 2, file or directory not found.
Hi all, I am having a weird problem with _wopen() function. I use _wopen() to open a text file A. The function works fine unless file B was created (and saved) in the same folder with file A. The errno returned from _wopen() = 2, which means file or directory not file. But file A is there all time. And again, it only happens if file B is just created and saved prior to using the _wopen() to open file A. If file B is already existed - which means that the code will detected its existence and will not create/save file B, and then _wopen would open the file A just fine. Is there any chance that because adding a new file to the same folder causing the directory listing order changed, which causes _wopen() ...Show All
