|
There are dozens of tutorials on this subject. I would recommend learning the "right" (there are others) way and looking through this article first. It will guide you in best practice for securely and efficiently connecting to databases.
http://www.codeproject.com/KB/database/ParameterizingAdHocSQL.aspx[^]
Once you have a DataSet or DataTable, you can just set it as the datasource for the grid and bind it.
myWebGrid.DataSource = myDataSet
myWebGrid.DataBind()
|
|
|
|
|
hi,
i am using two check boxes on my form (chkError & chkBlock) .. i want user will be able to check only one check box at a time not both... how can i do this.. please help..!
|
|
|
|
|
in checkbox_checkedchanged-event: when one checkbox is checked, uncheck all other checkboxes.
"I love deadlines. I like the whooshing sound they make as they fly by." (DNA)
|
|
|
|
|
If only one can be checked at a time, why not use option buttons?
modified on Tuesday, August 19, 2008 9:43 AM
|
|
|
|
|
Radio buttons are the way to go. The visual indicator of a radio button is a clue to the user that only one of the possible choices can be selected at a time.
Check boxes are used to show that one or more options are valid.
Think of pizza: (checkboxes)
Cheese
Mushroom
Onions
Sardines
Or Gender: (radio button)
Male
Female
|
|
|
|
|
Radio buttons are the way to go when there are a number of choices of which exactly one will be selected. Sometimes checkboxes can be a good choice, however, in cases where zero items is a possibility, or especially in cases where there are many attributes of which only a few are mutually exclusive. For example, a word processor may use checkboxes for bold, italic, underline, allcaps, and smallcaps, superscript, and subscript, even though allcaps and smallcaps are mutually exclusive, as are superscript and subscript. Such an approach would be far more intuitive and logical than having three checkboxes (bold, italic, and underline), and two sets of three radio buttons (allcaps/smallcaps/neither, and superscript/subscript/neither).
|
|
|
|
|
I have been developing some custom controls and want to be able to have them as functional as the controls that come with visual studios. Ive been working with the ControlDesigner class and i believe that is in relation to what i need for this as well but i can not find any examples.
I want to have it so that when a user is typing a function of the control that it provides custom information to the user in the form of the context-sensitive help that pops up. IE i want to provide the user with example usage.
I would be grateful if some one could point me in the right direction to do this.
|
|
|
|
|
To get some of the design-time integration like what I believe you are requesting, you can take a look at one of my articles: Targeting Design-Time Events of User Controls[^]
Regards,
Thomas Stockwell
Programming today is a race between software engineers striving to build bigger and better idiot-proof programs, and the Universe trying to produce bigger and better idiots. So far, the Universe is winning.
Visit my Blog
|
|
|
|
|
Hi, i am somewhat of a new programmer to visual basic... progamming knowledge at a bit of a sad low level. part of the program i am building requires the following:
my so called client leases out spaces on pieces of land for whatever purpose, in a sort of perfect grid. firstly, the layout of how the land will be divided is loaded as a template to the system, details stored on database... total plot dimensions, and vertical and horizontal spaces is stored. the program generates a little grid display of what it might look like, thats simple enough. when the user requires a piece of land to be formatted according to his needs, the template is selected from database, new entry is created in a table dealing with active plots. for each sector of land, a serial number gets generated, each sector state set to "vacant".
the problem on my part (due to my pathetic coding skills) comes in with coding the actual bookings part of the system. when the user selects the appropriate plot of land to perform bookings on, an interactive display of the plot needs be generated out of information in the database table. occupied sectors and vacant sectors in different colours, and the user needs to be able to highlight various (multiple) vacant sectors to book for his client. when "book" is clicked, the status field in the land plot table needs to be changed from "vacant" to "occupied".
i have a very very vague idea on how this is to be done, but at the moment, am completely stuck. not a clue as to how to generate the plot of land on screen with the different colours from the information in the database table, and beyond that, how to make it "interactive" with mouse events annnnd how to program it to return the values of which sections were selected i'd really appreciate any suggestions.
modified on Monday, August 18, 2008 8:22 PM
|
|
|
|
|
brajoez wrote: somewhat of a new programmer to visual basic
brajoez wrote: my so called client
brajoez wrote: due to my pathetic coding skills
Why do you have a client if your skill level is so poor ?
You basically need to handle the paint event, draw your land, track your mouse movement and actions and store changes back to the DB. I suspect you know that already, but if you do, I'd suggest making a start and asking specific questions as you get stuck. I'd be inclined to create a class that represents one object in the DB, and write it so that it responds to mouse events and knows how to draw itself, then call the draw code for your collection of objects in onpaint, and find the object your mouse is over in mouse events to pass it the event.
Christian Graus
No longer a Microsoft MVP, but still happy to answer your questions.
|
|
|
|
|
Christian Graus wrote: Why do you have a client if your skill level is so poor ?
Possibly because his strong marketing skills.
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong.
-- Iain Clarke
[Image resize DLL]
|
|
|
|
|
no my brother. this is africa. i am a plumber, electrician, mechanic and a carpenter as well. we do what it takes to make money. im not too good at the plumbing thing though...
|
|
|
|
|
brajoez wrote: this is africa.
Your profile states USA .
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong.
-- Iain Clarke
[Image resize DLL]
|
|
|
|
|
|
brajoez wrote: my vhost
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong.
-- Iain Clarke
[My articles]
|
|
|
|
|
Hi everybody.
Can anyone please help? i have the following problem:
as per title, i need to add a code module to the active vb project at runtime, like i know and i have experimented is possible from the Vbe object in vba.
Please see this article to understand what i mean:
http://www.cpearson.com/excel/vbe.aspx
So, to come to the point, i have added a reference to 'microsoft visual basic 6.0 extensibility' in my project references, then i have added this testing code to a form:
Private Sub Form_Click()<br />
Set x = VBIDE.VBE<br />
s = x.ActiveVBProject.Name<br />
End Sub
but it throws an error at runtime ('method or data member not found').
i think the reason for this error is that the VbIDE.Vbe object only refers to the vba IDE (the one you see built in msoffice applications), not the vb6 IDE i am working in. i need to first get a reference to my project, to be able to add a code module to it at runtime!
i have also tried to set a reference to 'microsoft development environment 6.0' in my project, to use DTE.projects property, but still no luck.
can anyone help? it's driving me mad...
thank you very much in advance
ps: why do i want that feature to work? because i need to add a control to a form without any previous knowledge of what type of control it will be. E.g. (roughly describing the situation) i have a textbox and a command button on the form and must add to the form the type of control the user enters in the textbox text.
|
|
|
|
|
Why not have a dropdown of the controls your willing to add to the screen and have predefined routines that are coded to add each type to the form? You have know something about the control otherwise it will just be "dead" on the form (no events).
'Never argue with an idiot; they'll drag you down to their level and beat you with experience.' ~ anonymous
'Life's real failure is when you do not realize how close you were to success when you gave up.' ~ anonymous
|
|
|
|
|
that's exactly what i want to avoid.
let's say the matter is a bit more complicated in fact.
first of all, i have explained myself at least very badly. if i'd just like to add to the form a control which type i don't know (for it must be entered by the user) then i'd only need to write code like the following (never mind the new control's events-management with event handlers, for now -- like you said the controls will be dead on the form):
<br />
Dim x As Object<br />
Set x = Me.Controls.Add(textbox.text, "Button1")<br />
x.Visible = True<br /> ,
leaving to the user the responsibility to fill textbox.text with the correct object-identifier string -- in this case textbox.text should be "Vb.CommandButton"
but the fact is i want a function (called SetObjectProperty) to set, of a specified object, a property i don't know. To be more clear, the arguments of the function must be:
SetObjectProperty(Control as string, Property as string, Value as variant).
let's suppose the user doesn't worry about passing the Control argument to the function (he only wants new command buttons to be created on the form): but the user wants to set a property for that object! he wants the property indicated in the Property argument to be changed, for the new command button, to Value. so, let's also suppose, to simplify things, he enters in a textbox1 a string representing the property of the command button he intends to change, while in a textbox2 a string representing the new value of that property: well to handle this i can't have code such as for example
<br />
<br />
Dim x As CommandButton<br />
Set x = Me.Controls.Add("Vb.CommandButton", "Button1")<br />
x.(textbox1.text)= textbox2.text '<-- that's wrong<br />
<br />
i can't do unless i add some code to the project at runtime (it is the only way i can imagine; if other exist to access a property of a control, please tell me)
and since i am writing an activex dll, writing a pair of property get/let procedures (for each property of each new control i let te user create on the form) would be frustrating, and moreover would sensibly reduce code-processing speed and efficiency.
modified on Tuesday, August 19, 2008 2:23 AM
|
|
|
|
|
i answer to myself. it's pretty sad, but...
about setting a property one doesn't know, in vb6 there is the callbyname function (search the msdn guide or refer to this article.
in vb .net one should use the setproperty function.
about adding code modules at runtime, which is my problem, i still have not found a solution, but if there is a method in vba, why shouldn't there be one for vb6?
thank you the same
|
|
|
|
|
Hello!
In a website, a result database is accessed only by ID of the students. Is there any way to make a loop on that control(a textbox and a submit button) to put numbers(ID of student) in the textbox and retrieve the information i.e. result?
|
|
|
|
|
I might not know what you're asking, but if it's in a website you might want to try the ASP.NET forum.
|
|
|
|
|
Of course.
Christian Graus
No longer a Microsoft MVP, but still happy to answer your questions.
|
|
|
|
|
Christian you are an evil bastard but I think you were too verbose - Yes would have done
Never underestimate the power of human stupidity
RAH
|
|
|
|
|
I honestly answered his question as best I could with the info provided. If he provided some more info, I could be more specific.
Christian Graus
No longer a Microsoft MVP, but still happy to answer your questions.
|
|
|
|
|
damn. u people can actually code. respek :P
|
|
|
|
|