Tiago Salgado's Q&A profile
Visual Studio 2008 (Pre-release) How to cancel a context menu from opening in Windows app
I'm working in a window app: 1) When user right clicks on a control to open the context menu, and before it opens I want to run logic to determin which menu items to enable and disable. What's the best event to do this in The only event I found that I could do this is the context menu loaded event. 2) After the right mouse click and before the context menu displays, if certain conditions exists I want to cancel the menu from opening as if it didnt exist. How can I do this Thanks. This event doesnt fire for me. Using WPF (Dec 06) windows app: ContextMenu contextmenu ; contextmenu = new ContextMenu (); contextmenu . ContextMenuOpening += new ContextMenuEventHandler ( ContextMen ...Show All
Windows Forms Switching between Console application and Windows Forms applications
I was hoping to write a single application that can behave as Console application if specific run parameters are specified and behave as Windows Forms application otherwise (of course without the Console). For example: public static void main(string[] args) { if(//check if args has specific run params) { //do stuff Console.WriteLine(//results); return; } else { //Show nice form and all that } } Couldn't find any pointers as to how to achieve this. Any pointers Mad.Earth sure, lets give this a bash I tried it, no errors! Change the startup mode of the application to Console Application in the project properties. you can then see the arguments etc... Si ...Show All
Visual C# Moving a byte array between C# and C++
Hi Guys, hope you can help. I am currently writing a managed C++ wrapper to interface with some unmanaged C++ code so I can utilise the code in C#. Everything is working absolutely fine except I need to be able to pass in a managed buffer from C# in a C++ function, modify the buffer in the function and pass the results back to C#. I currently have the following: C++ code: public : void Play(System::Byte buffer[]) { char buffer2[44100]; // Fill the unmanaged buffer pSidplay2->play(buffer2, 44100); //buffer = buffer2*; // Copy the unmanaged data into the managed buffer for (int i = 0; i < 44100; i++) { buffer = buffer2 ; } } C# code: private void button1_Click(object sender, ...Show All
Visual Studio 2008 (Pre-release) Displaying DataTable in run-time
Hi, I've got the following issue: My application is intended to show any table from the database. It means that the structure of the table is only known in run-time. I looked through the samples, but all the examples contain DataTemplate definition in XAML file that is not my case. I browsed the documentation but did not manage to fing the way how to create DataTemplate programmatically. Are there any ideas how can I display a table when its structure is only known during runtime. TIA Thank you. But ListView.ItemsSource is supposed to implement IEnumerable interface, but neither DataSet nor DataTable do this :-( ...Show All
Visual FoxPro Source from internet
Where can I find a source on the internet where will be wethear forcast for Slovakia and the other world... I want to include it in my program, to show the weather forcast, just temperature, humidity, air pressure, wheter it will rain, or snow, etc. Don't know wheather this kind of source exists... Thank for your advice If you want to receive the data as a Web Service from a public server, you need to find a server that publishes weather data for Slovakia in XML (SOAP) format. These are generally published in public directories such as XMethods or Microsoft's UDDI directory. I do not know of a service that gives you Slovakian weather information. You will have to research through Google or ...Show All
.NET Development What do connection string symbols, such as the vertical bars, mean?
The wizard built this connection string: Data Source=.\SQLEXPRESS;AttachDbFilename=|DataDirectory|\KwikBoex_Config.mdf;Integrated Security=True;Connect Timeout=30;User Instance=True In particular, I want to know what "|DataDirectory|" means. I did a help search on "|" and also looked in the index for "|". It says it is a "bitewise or". I understand "bitewise or". But what does "bitewise or" mean in a connection string Where in the (pardon my language) "Microsoft Help" can I find out what it means NOTE: I am serious about this question. I want to know what it means. I hope you enjoy the "Microsoft Help" attempt at humor. I find Microsoft Help in V ...Show All
Game Technologies: DirectX, XNA, XACT, etc. Multiple Lights on a scene
Hello ; I want to learn an important technique which I can not figure out till today. Even in old games (such as Half-life ) we can see several lights in a scene. But when I look my graphics card capabilities it suppports max 8 active lights. Considering the time which Half-life built the graphic cards were less capable. So I wonder how they can achieve this effect. (Can they be using different textures for each face to imitate real lights if so the game should require too much resources.) Thanks The limit in the caps reference to the fixed function pipeline. With shaders you can calculate more lights but this isn’t even necessary at all. As you have to draw object by object most times these light ...Show All
Visual Studio 2008 (Pre-release) gridview
Hello, I have a bunch of listviews that have the exact same shape but use different itemssources. So I thought I would try to share the gridview between the listviews. I put the gridview the resources and tried to use it but as it turns out two listviews can't share the same gridview. I was wondering is there a way around this Or do I need to wrap the listview in a user control Thanks Houman Hi Lee, Yes that's exactly what I mean, they have the same set of columns. And the columns have the same displaymemeber binding. I have 2 list views (source list view, target list view) and two buttons (add, remove). When I click the add button the selected elements from source list view is mov ...Show All
Visual Basic Timer countdown?
Hi, Ive looked for like 4 hours and this is only for fun... How do I make a timer countdown to midnight for example. And could there be answers with the time to countdown to as what would be select in a combo box thanks. Nothing to hard don't strain yourself trying to help me... Or instead of using timespan calculate difference in seconds. Something like the following Public Class Form1 Const SecondInHour As Integer = 3600 Const SecondInMinute As Integer = 60 Const MidnightTimeInSeconds = 86400 '24* 3600 Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load Me.Timer1.Interval = 1000 Me.Timer1.Enabled = True End Sub Private Sub Timer1_Tick(ByVal send ...Show All
SQL Server Notification services folder in Object explorer
I have created set up in my system succesfully.But there is no Notification services folder in Object folder.Please help me I am new to notification services.I can't able to proceed. What edition of SQL Server did you install SSNS is only available in Standard and Enterprise editions. Did you opt to install SSNS during the install of the instance HTH... Joe ...Show All
Visual Studio Team System Stakeholder for requirement?
Shouldn't the stakeholder be a property of a CMMI requirement You can customize the Requirement work item type to add a field that carries the stakeholder information. I'm guessing some teams prefer to have the stakeholder information in the Requirements document rather than in the work item. However, if you want to run queries or generate reports that show the stakeholder information, then having the info associated with the work item is better. Look at this link for information on customizing work item types. http://msdn2.microsoft.com/en-us/library/ms243849.aspx Thanks! ...Show All
Visual Studio 2008 (Pre-release) Certificates... one tiny question
I think I have understood that a server certificate helps the client to know that it's the "correct" server it's talking to, and not someone pretending to be the correct one. However, I have not fully understood if the certificate (i.e. X.509) is required to get encrypted communication between the client and the server. Or, is there something else built into WCF that will encrypt the communication without usage of external certificates Regards Andreas In most scenarios you should be decoupling your security requirement from the Service API ie your contracts. Now sometimes if you are doing some security related services then this might be a different case and thinking about security and em ...Show All
.NET Development Visual Basic 2005 passing parameter to Oracle SQL
Hi, I am using VS 2005, Oracle 9i, and have a question on passing a parameter to the query defined in a DataSet. All the examples I've seen use the use this syntax “ Select * From Customer Where CustomerId = @CustID” The problem I’m having is – I get an error on the @CustID. The SQL generator puts Quotes around it making it worthless. How do I do this Thanks VERY much, Carl I'm also using oracle as my database. I resolved the ": param1" issue, how do you use "like" in your select statements. i'm familiar with ms sql SELECT FIRSTNAME, LASTNAME, EMAILADDR FROM TBLINDIVIDUAL WHERE (LASTNAME like @PARAM1 + '%') how do you write this in oracle i trie ...Show All
Visual C# How to Create a URL syntax checker in C#
I would like to create a URL syntax checker so that can verify a cerrtain URL not a phish site. But I am also aware that some URL have valid syntax but is still a phish site. To answer this, I am looking for some measures on how to verify a URL and its correct DNS equivalent. I am doing a project of mine as one of our requirements and I have decided to create a web browser (already done) and I have included there 3 anti-phish tools. One of the tools is to check for URL syntax error. i have searched for such but has given me no good results that can be of any help to my project. I was hoping that some of the bright minds here could help me or enlighten me in my search. Thanks. Hi, Is this a good means for catching URL that is ...Show All
Visual J# jung for .net
Hi, Has anyone tried converting jung (java unversal network/graph framework) the source is available in jung.sourceforge.net. I've tried importing all the source code, but have problem with the apache component. This probably lead to further question, have you tried converting apache to J#. Sincerely Anthony Oh well, nevermind. Your answer sounded like, I might have offended you. i was hoping a simple answer yes or no to both questions. or someone might have tried and can tell experience. Anthony ...Show All
