Sami Zaghloul's Q&A profile
Visual Basic Getting data from a database using a primary key
Hello. I am having trouble with a program. I want to be able to get some data from my database table, given the value of the primary key. This is what I have so far: projectName = DbDataSet.Projects.FindByid(projectId).name where projectName is a String, and DbDataSet is my dataset. The variable projectId is the ID of the row I want to extract the data from, but every time I run my code I get a NullReferenceException. I know that the row with the primary key value of projectId exists because I can see it when I view through server explorer. Any help would be fantastic Bryan St. Amour You have several objects ...Show All
Visual C++ Compiling with Platform SDK - doen'ts understand BOOL and WINAPI etc.
I downloaded VC++ 2005 Beta 2 & the Platform SDK. I'm having trouble compiling. I generated a console application. My program has this include: #include "stdafx.h" Inside sdtafx.h I have this code: // stdafx.h : include file for standard system include files, // or project specific include files that are used frequently, but // are changed infrequently // #pragma once #define WIN32_LEAN_AND_MEAN // Exclude rarely-used stuff from Windows headers #include <stdio.h> #include <tchar.h> // TODO: reference additional headers your program requires here #include <psapi.h> When I try t ...Show All
.NET Development DataGridView + DataAdapter Edit Weirdness
Hello, I originally posted this thread in another forum but someone suggested I repost it here: I have a DataGridView setup with a DataAdapter. There are a few fields on a couple of rows that I update programatically which causes the DataAdapter to want to update the data in the database every time I run the DataAdapter's Update method. Is there anyway to set the status of the row to NOT update the database (at least until a user edits something) Thank you -Adam Plocher Hi, Ooops. Forgot about that. You could just call the DataTable.AceptChanges() method to mark all of the rows into Unchan ...Show All
Visual Studio Team System How to avoid Designer classes
How do we avoid throwing warnings for Designer class variables like resourceMan, resourceCulture, temp etc. And how to avoid system generated methods like .cctor etc For cctor's, check whether a Method is actually a StaticInitializer, eg: if (method is StaticInitializer) return null; To eliminate certain members, you need to examine the member.DeclaringType. The easiest thing to do is look at Member.DeclaringType.FullName and compare it to the type name you want to exclude. Don't forget to keep walking up the inheritance hierarchy (by examining the declaring type BaseType member) until it is non-null. We will probably prov ...Show All
Visual Studio Express Editions Appending text in textBox control
Hi All, I have a webBrowser control in my C# winform app. This works beautifully and I have a textBox control (called txtAddress) as the address bar. This also works beautifully apart from one small detail. I have noticed that when typing in a URL to navigate to I have put http:// at the beginning of the address. This is not a problem for me but I know that some of our users will only put the www at beginning of the addy. To get around this problem I thought about composing a method that invokes before my navigating method that checks to see if http:// is at the beginning of any text inputted by the user into txtAddress. If it is no ...Show All
Windows Forms Order of columns in a DataGridView
How do I order the columns in a DataGridView control I've set them all up by right-clicking and selecting Edit Columns, and set the order I want them to appear in using the up & down arrows, but when I run the application, they just go an mix themselves up... Any ideas - Mina http://forums.microsoft.com/MSDN/ShowPost.aspx PostID=319362&SiteID=1 ...Show All
Visual Basic Is it there?
Here is what I have in my password form. Public Class PassCreate Dim strPass As String Private Sub btnPassCreate_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnPassCreate.Click strPass = txtPasscreate.Text My.Computer.FileSystem.WriteAllText("C:\Pass.txt", strPass, True) Me.Hide() PGS.Show() End Sub End Class What I want is If C:\Pass.txt <> exist then create a password write it to a file C:\Pass.txt hide form and show main elseif C:\Pass.txt does exist then enter password and if it matches C:\Pass.txt hide this form and show main. Thanks ye ...Show All
Windows Forms Datetimepicker bug
i have a datetimepicker with a showcheckbox property set to true. I set the format of the date to MM/dd/yyyy so that i can input numeric dates. But everytime i input the numeric dates the cursor focuses on the checkbox control. This is obviously a bug. is there any workaround to this problem please help. To attempt to clarify your issue, you have a DateTimePicker on a form with other controls. Programatically setting the date of the DateTime control forces focus away from whatever control had it before to the DateTimePicker If that is what you are stating, I have not seen this behavior. The CheckBox does get the yellow focus, but doe ...Show All
SQL Server Create 1 connection to execute multiple Packages
I want to create 1 connection because I have to execute multiple packages (2005). But when I go into the execute package task editor, the dropdown only ever has "New Connection". Is this a bug "Why can't the EXECUTE PACKAGE task just use one of the connections available in the "connections managers" collection " It can, If all your execute package tasks are in the same package, yes, they can all use the same connection manager. Is this not working for you Whew, thats all i need, maybe its a bug - using June CTP. I create a new execute package task and then create a new connection for it. Then I c ...Show All
Visual Basic Decimal number format
I've a simple question but can't find any existing solution. Please help. How can I format a decimal number in the following manner 6.000 ---> 6 2.5 ---> 2.5 I want to format the decimal so that the trailing zero as well as the decimal point will not be shown in case of a whole number. Hi, You can do your formating on the string format. dim d as decimal dim s as string d = 4.0000 s = d.tostring("0.#") ' add additional # for decimal places to be round off ' you can use also the formating of d.tostring("0.0") or ' d.tostring("0.00") add "0" after the "." to set the nos of decimal places the result of s ...Show All
Smart Device Development Catch power button event
I'm trying to understand what happens behind the scenes when a user hits the power button on a PocketPC WM 5.0 device. My goal is to capture/prevent the event that causes the device to go into suspend mode, prompt the user to confirm their action, then continue accordingly. I'm an ISV trying to guard against an accidental hit. Any tips Here is an excellent blog post by Anthony Wong about power events. http://blogs.msdn.com/anthonywong/archive/2005/06/07/426392.aspx Manav ...Show All
.NET Development Never trust a tickcount
Hi, For those who use tickcount for any calculation on your application... DO NOT USE IT. Simply, for some idiot reason the tickcount returns an integer, so if you have a server that runs all the time or if you have a multiprocessor environment the tickcount overflows and returns 0! But for my surprise if you use Tickcount.ToString() actually returns the string version of a 64bit value, so is not 0!!! Funny when you are trying to debug your application and ToString() says 43453345345444 but the property returns 0 One of those funny things, pretty sure that tickcount internally is a 64 bit value and the property cast it to a 32bi ...Show All
Visual Studio VS2005 July CTP under Virtual PC - shortcutCLTDbg32.txt can't be read
I've been trying to install the July CTP of VS2005 Professional under Virtual PC SP1 which is running Windows Server 2003 SP1 and it invariably fails towards the end of the main install trying to read D:\VS\Program Files\Microsoft Visual Studio 8\SDK\v2.0\GuiDebug\shortcutCLRDbg32.txt telling me the file was not found and offering me the choice of Retry (which loops failing with the same message) or Cancel (which does a rollback). That file is on the disk and appears to be a multi-stream file. It can be opened in Notepad in the host operating system (Windows XP SP2) ie outside the VPC with no problems. Notepad displays its content ...Show All
.NET Development Can't get ComboBox to show correct value
I've got a dialog with a comboBox bound to a lateCodesBindingSource. The display and value members both point to the 'lateCode' field. I fill the dataset table using: this.lateCodesTableAdapter.Fill(this.appDS.LateCodes); In the dialog I attempt to preselect an item. For the life of me, I can't get the combobox to show a value I select thru the program. I've tried: lateCodesComboBox.SelectedText = preSelectedTextBox.Text; lateCodesComboBox.SelectedValue = preSelectedTextBox.Text; lateCodesComboBox.Text = preSelectedTextBox.Text; However, the comboBox does always shows the f ...Show All
.NET Development .NET on Linux
.NET on Linux, is this possible thanks Another option aside from Mono is the shared source CLI ( http://www.microsoft.com/downloads/details.aspx FamilyId=3A1C93FA-7462-47D0-8E56-8DD34C6292F0&displaylang=en ), you can also try searching for "Rotor". I dont believe it is supported on Linux, but it is on osX and BSD. One thing to note is that the license for this is different from the normal redist. Hope that helps. ...Show All
