|
Hi,
In my application I have a form with some comboboxes on it. These comboboxes are all bound to different datasets. When the form shows, I can select a different index in the combobox, the text is adjusted as expected. To here, I encounter no problems.
In some cases, when the form is loaded, I want to select a value in the combobox that I obtained by accessing my database.
Example of my code:
cboIncidentType.SelectedValue = curIncident.IncidentErrorType
Now, for some reason, the selectedValue is not set to what I define in my code, but to the first index in the combobox.
Can someone tell me what the problem is?
Thanks!
G72360
|
|
|
|
|
This depends on when this code is being called. If you're doing this at the beginning of the Form_Load event, the ComboBoxes haven't been filled yet...
Dave Kreskowiak
Microsoft MVP - Visual Basic
|
|
|
|
|
The comboboxes are filled before the selectedValue is set.
When selectedIndex 0 is returned, the datafield (text) of index 0 is shown, only it is not the index I tried to set.
G72360
|
|
|
|
|
I have icluded an SQL database file in my application and it now uses sqlexpress to attach that and use that file. It workes good but now I have to deploy sqlexpress 2005 with my application and it requires SP2 for Windows XP. Is there any other way I can use this SQL file without forcing all the customers to install SP2?
Any help is good because I'm desperate.
--Nikola--
modified 7-Dec-20 21:01pm.
|
|
|
|
|
Nikola Knezevic wrote: Is there any other way I can use this SQL file without forcing all the customers to install SP2?
Nope. It's the minimum system requirement for 2005. An older version MSDE, like MSDE 2000, on the other hand, doesn't require SP2. This will, of course, depend on your applications requirements.
Dave Kreskowiak
Microsoft MVP - Visual Basic
|
|
|
|
|
If MSDE 2000 can handle connection string below then you have solved my problem:
Data Source=.\SQLEXPRESS;AttachDbFilename=|DataDirectory|\ptcdb.mdf;Integrated Security=True;User Instance=True
But then I have one more question How can I add it in my prerequisites list in vs 2005?
--Nikola--
modified 7-Dec-20 21:01pm.
|
|
|
|
|
MSDE was the predecessor to SQL Express. The name changed when 2005 came out.
Nikola Knezevic wrote: How can I add it in my prerequisites
What prerequisites list??
I think you might be looking for something like this[^].
Dave Kreskowiak
Microsoft MVP - Visual Basic
|
|
|
|
|
OK so far I managed to do everything but connecting to msde none of the connection strings I've tried worked.
--Nikola--
modified 7-Dec-20 21:01pm.
|
|
|
|
|
Is there a way to override the code that vb.net generates for Deletes, Updates and Inserts?
The code generated is slowing down my app for these functions, especially for only 1 record.
I'm using the BindingNavigator controls to add, update, delete, etc.
PPOBindingSource.EndEdit()
PPOTableAdapter.Update(Me.DwCustomDataSetPPO.BenefitAdj_PPO)
Is there someway to over ride what Vb generated and create mo own code for these functions?
The generated code is inefficient and convoluted.
Any help greatly appreciated.
Mike
|
|
|
|
|
Can any one tell me how to deploy a web application?... where as the web application module uses a web service for some applications...
thanks
with regards ,
K.Vijaya
|
|
|
|
|
Developing a windows application with VB.Net under VS 2005. I am wondering if anyone knows how I can prevent validation events from firing if the user clicks on the control box close button to exit a form. I do not want to set the CausesValidation property on all of the form controls to False as I do want validation events to fire if the user is tabbing from control to control. However, the control box close button presents an apparently ugly issue because, when clicked, not only does the validation event for the control being exited fire but the FormClosing event still fires even if the validation event fails and the program issues a Cancel. Has anyone else run across this problem and found an elegant solution?
Thank you...
|
|
|
|
|
Well, the most "elegant" solution I've come up with so far is that the cancel property of the FormClosingEventArgs is set to True at the start of the event when a control just failed validation. So, I can check that property and if it is set to True as soon as the event starts, just skip any other code in the event. I would feel better about this solution if I could trust Microsoft not to change the behavior of CausesValidation to something that actually makes logical sense in a future update or revision. If anyone thinks they have a better solution, please let me know.
|
|
|
|
|
Hello!
I am using TSQL to add to access based database. I have been getting syntax error in INSERT INTO statement. Here is the statement. If you can recognize the error please let me know. Myrequest is a collection and it is working fine.
Thanks!
Dim SrchKey
SrchKey = "INSERT INTO Estates "
SrchKey = SrchKey + "(status,stockno,portfolio,type,city,town,suburb,rooms,heating,age,floor,size,price,exchange,properforcredit,"
SrchKey = SrchKey + "opportunity,listdate,deposit,depositamount,showmainpage,description,picture1,picture2,picture3,picture4,"
SrchKey = SrchKey + "picture5,picture6,RecordStatus,SoldRent,HitCount) VALUES ("
SrchKey = SrchKey & myRequest("status") & ","
SrchKey = SrchKey + "'" & myRequest("stockno") & "',"
SrchKey = SrchKey + "'" & myRequest("portfoy") & "',"
SrchKey = SrchKey + myRequest("type") & ","
SrchKey = SrchKey + myRequest("city") & ","
SrchKey = SrchKey + "'" & myRequest("town") & "',"
SrchKey = SrchKey + "'" & myRequest("suburb") & "',"
SrchKey = SrchKey + "'" & myRequest("rooms") & "',"
SrchKey = SrchKey + "'" & myRequest("heating") & "',"
SrchKey = SrchKey + "'" & myRequest("age") & "',"
SrchKey = SrchKey + "'" & myRequest("floor") & "',"
SrchKey = SrchKey + "'" & myRequest("size") & "',"
SrchKey = SrchKey & clng(myRequest("price")) & ","
SrchKey = SrchKey + "'" & myRequest("exchange") & "',"
SrchKey = SrchKey & myRequest("properforcredit") & ","
SrchKey = SrchKey & myRequest("opportunity") & ","
SrchKey = SrchKey + "'" & myRequest("listdate") & "',"
SrchKey = SrchKey & myRequest("deposit") & ","
SrchKey = SrchKey & myRequest("depositamount") & ","
SrchKey = SrchKey & myRequest("showmainpage") & ","
SrchKey = SrchKey + "'" & myRequest("description") & "',"
SrchKey = SrchKey + "'" & SetFileName(0) & "',"
SrchKey = SrchKey + "'" & SetFileName(1) & "',"
SrchKey = SrchKey + "'" & SetFileName(2) & "',"
SrchKey = SrchKey + "'" & SetFileName(3) & "',"
SrchKey = SrchKey + "'" & SetFileName(4) & "',"
SrchKey = SrchKey + "'" & SetFileName(5) & "',"
SrchKey = SrchKey & -1 & ","
SrchKey = SrchKey & False & ","
SrchKey = SrchKey & 0 & ");"
|
|
|
|
|
Its near on impossible to tell you what the syntax error is from what you have provided, but here are some tips.
1) You are mixing '+' and '&' for string concatentation - pick one and stick with it.
2) You should not be building up a SQL query in this way, it is unsafe and leaves you open to SQL Injection attacks.
3) Try writing out the content of SrchKey after building this string to a messagebox (for example) - it will help you spot the error (Which is likely to be a missing quote, or a missing comma)
Current blacklist
svmilky - Extremely rude | FeRtoll - Rude personal emails | ironstrike1 - Rude & Obnoxious behaviour
|
|
|
|
|
Hmmm.... A few things...
1. Be consistent with the string concatenation... use & rather than +.
2. Put single quotes around all string values. SQL won't accept them otherwose.
3. Check that any numeric values you enter are properly constructed in VB (e.g. this line SrchKey = SrchKey & -1 & "," really should be like this SrchKey = SrchKey & "-1," .
4. Debug the app and breakpoint at the point where the entrie string has been constructed. Inspect it for syntax errors.
...Steve
1. quod erat demonstrandum
2. "Give a man a fish and you've fed him for a day. Teach him how to fish and you've fed him for life." I read that somewhere once
|
|
|
|
|
And for the love of SQL, scrap this thing and use a parameterized query instead!! You've just found out one huge reason why!! Search the articles for "SQL Injection" and look for the article by Colin Angus Mackay. It has an explaination of how to do this.
Dave Kreskowiak
Microsoft MVP - Visual Basic
|
|
|
|
|
Hi,
I have an application that compresses SQL data backups and writes it to a DVD-RAM drive on a daily basis.
How could programmatically format the DVD in VB6/.Net?
Thanxs!
you can't forget something you never knew...
|
|
|
|
|
There is nothing in the Win32 API that will do this. You'll have to find an application that does this already or see if there is an SDK for the DVD burner software that you have installed.
Dave Kreskowiak
Microsoft MVP - Visual Basic
|
|
|
|
|
Dave Kreskowiak wrote: You'll have to find an application that does this already
How did these guys do it?
Thanks, at least I know to stop trying to code it myself.
you can't forget something you never knew...
|
|
|
|
|
Getting to know the drivers inside and out, and knowing the commands the drivers and drives understand and using the Win32 function DeviceIoControl[^] to send them...
Dave Kreskowiak
Microsoft MVP - Visual Basic
|
|
|
|
|
How is it possible to set the size of the grouptree in a Crystalreportviewer object? This is only possible at runtime. The only available option is to display or hide the grouptree (using the DisplayGroupTree value).
-- modified at 9:45 Tuesday 25th April, 2006
|
|
|
|
|
Hi all,
Is there a book or web site that has all error codes listed with a good description of what each one means?
Thanks, Garner
|
|
|
|
|
Ive always found google to be perfect for this, just paste the error code or error message into the search and you will find a plethora of discussion on that error.
Current blacklist
svmilky - Extremely rude | FeRtoll - Rude personal emails | ironstrike1 - Rude & Obnoxious behaviour
|
|
|
|
|
I want shutdown a computer in the LAN. Who help me !
nguyen kiem
|
|
|
|
|
CodeProject article.
Somebody didn't search before he posted
--------------------------------------------------------
My development blog
Q:What does the derived class in C# tell to it's parent?
A:All your base are belong to us!
|
|
|
|
|