|
mmcsherr wrote: but I want to control what gets entered, such as a validation routine, retrieve the data, text, integers, IP address, etc
This is normally done by individual controls, specific to the input purpose. You really wouldn't want to input text into a box (or control) that's expecting an IP address. An IP entry is usually 4 boxes, each expecting a number between 0 and 255 and hitting the period key moves the focus to the next box, whereas text would be in a single box.
mmcsherr wrote: and be able tell if they hit ok or cancel all within VB6 or MS Access basic.
This is done by setting and getting the form's Dialog Result property in VB. I don't know about Access since it's VBA and works quite a bit differently than VB6 or VB.NET.
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
For instance, you create a new form, place a text control on the form, I want to pass to the form, the length of the text field, set the limit on the control. I place an OK and cancel button on the form so I can tell that the user has selected to either take the text entered and clicked OK or has cancelled the operation al together. How do I pass an argument to the form, ie, the text length limit and how do I pass the text entered back to the calling routine?
I can create forms and controls and add code to modify behavior, and get the text entered within the control on the form using code within the form, but not sure how to get that text back to the calling routine.
|
|
|
|
|
There's a couple of ways of doing it.
Change the Textbox from "private" to "public" in its declaration. (Not really a good idea!)
Add a public Property to the form that get's/set's the Text value of the still private TextBox on that form. You can add another Property that get's/set's you TextLength.
The Form doesn't pass anything back. It's not it's responsibility to know anything about the code that called it. The form handles just the input of the Text and obey's the limits set by the Properties to add. It's up to the caller to retrieve the data it needs through the form's Properties.
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
How would I go about writing something that would generate all possible character combinations for a given length and properties, such as uppercase/lowercase/both, numbers/letters/both, etc?
For example, if you put in say, 2 digits, it will generate:
aa
aA
ab
aB
ac
aC
...
Aa
AA
Ab
AB
Ac
AC
...
etc...
Has anyone done this, and if not, how is the best way to do this?
|
|
|
|
|
Nested loops, or recursion would be the two obvious answers. Why do you need to do this ? Are you trying to crack passwords ?
Christian Graus - Microsoft MVP - C++
|
|
|
|
|
Hmmm, how would I go about this? Is there an example for nested loops somewhere?
|
|
|
|
|
A nested loop is just something like this
for (int i=0;i
|
|
|
|
|
yes indeed, why would you want to do this - maybe it's something as innocent as a class assignment, but maybe not...
if it is innocent though, an example in VB like the one above - just in case you are sitting there scratching your head - is as follows:
Dim x, y As Integer 'declare x and y - your counting variables<br />
For x = 1 To 20<br />
'anything inside this loop, including the following loop, will be repeated 20 times<br />
For y = 1 To 30<br />
'this loop will repeat anything inside it 30 times<br />
Next<br />
Next<br />
Of course you're not limited to "For" loops; you could use any kind of loop.
And if you're still sitting there scratching your head, then you need to learn a little more about programming in general - buy a book or take a class. btw Good luck with those passwords - I mean that assignment.
sincerely, Brett Peirce - PolerBear
To err is human; To forgive: divine.
-- modified at 0:16 Thursday 20th October, 2005
|
|
|
|
|
After compiling and building executable, how do I make a system install and uninstall feature; ie. through using something like setup.exe? I have never done this before and client wants it this way.
|
|
|
|
|
Advancedinstaller.com would be my recommendation.
Christian Graus - Microsoft MVP - C++
|
|
|
|
|
Greetings all.
I am working on an application that displays a grid with dropdownboxs in various parts of this grid. Now the entire gird is generated dynamically based on user interaction, so i have put the code required to generate this grid in an .ascx file. Here is my problem:
My grid is generating perfectly, but I am stuck on this on part: I currently have the functionality that is the user changes an item in any of the dropdowns, the form will postback to itself, however, i am unable to get the selectedIndex.Text or Value.
first let me share with you how i create the drop downboxes:
hwriter.WriteBeginTag("select")<br />
hwriter.WriteAttribute("name", i.ToString)<br />
hwriter.WriteAttribute("OnChange", "javascript: " & Page.GetPostBackEventReference(Me, Me.UniqueID))<br />
hwriter.Write(HtmlTextWriter.TagRightChar)<br />
hwriter.WriteBeginTag("option")<br />
hwriter.WriteAttribute("value", "ins~" & intUsers(i).ToString & "~" & intLinkId.ToString & "~" & dt.Rows(x).Item("roleValue"))<br />
hwriter.WriteAttribute("selected", "selected")<br />
hwriter.Write(HtmlTextWriter.TagRightChar)<br />
hwriter.Write(dt.Rows(x).Item("name"))<br />
hwriter.WriteEndTag("option")
This code is rendered to the page from my user control's method:
Protected Overrides Sub Render(ByVal hwriter As System.Web.UI.HtmlTextWriter)
The way the above code is laid out, when a postback occurs, my eventArgs is the value of: 'Me.UniqueID' which does me no good. I have looked through my VS.Net help files and there are examples on how to do this with a button and raising the click event, I can not duplicate this for the onChange event??? Any help as to how I can get the values of the selected item would be greatly appreciated. -Doug
"There is nothing more honorable then doing a thing well"
|
|
|
|
|
Follow-up:
While I don't think that this is the "best" way to accomplish this I have found somewhat of a work around to solve my problem at hand.
Using the supplied code as a reference,
I changed the
Page.GetPostBackEventReference(Me, Me.UniqueID))
to
Page.GetPostBackEventReference(Me, i.toString))
when a user changes the value of a dropdown the method:
Public Sub RaisePostBackEvent(ByVal eventArgument As String) Implements System.Web.UI.IPostBackEventHandler.RaisePostBackEvent
fires and the name of the dropdownbox is passed in as an argument. From here I call another method that excepts a string as a parameter (the dropdown ID) and then use the
Request('dropdownID')
to get the values that are sent via postback.
So that is one possible solution, though if anyone has any input or thoughts they are greatly appreciated!
"There is nothing more honorable then doing a thing well"
-- modified at 12:06 Wednesday 19th October, 2005
|
|
|
|
|
Ok, here's my problem:
I have a windows form program consisting of a parent MDI window and a series of MDI child forms within. Only one form is ever showing, and it is maximized.
On one of these forms, I have placed the AxWebBrowser control.
The first time I use Navigate to get to a URL, everything works great.
But if I then hide the form with the control and reshow it, the next time I Navigate the Web Control appears outside of the form in the upper left hand corner of the desktop (complete out of the MDI frame too).
Any idea what is going on? How can I avoid this?
|
|
|
|
|
Hi All,
I want the visual basic code to transfer the data from a VB application to the online application, similar to a text box in a website. I request you to email the code to tejassoft@yahoomail.com
-- modified at 14:48 Tuesday 18th October, 2005
|
|
|
|
|
If you want code written for you, go to www.RentACoder.com.
If you want help with your code, you've come to the right place. But you have to ask a specific question.
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
hellow to all ..
i was wondering how i can past data of text that i had copy useing the right mouse click and copy ?
in vb code of course ...
|
|
|
|
|
wow is my question is too much genius to be answered in here ?
-- modified at 13:06 Thursday 20th October, 2005
|
|
|
|
|
Help, I must be missing something simple
I declare (as I did in VB6) the following
Declare Function WritePrivateProfileString Lib "kernel32" Alias "WritePrivateProfileStringA" (ByVal lpApplicationName As String, ByVal lpKeyName As Object, ByVal lpString As String, ByVal lpFileName As String) As Integer
then I try to do this:
WritePrivateProfileString("test", "testKeyName", "AAA", "d:\temp\test.ini")
and I get this
Error "Object reference not set to an instance of an object"
any ideas are welcome...
|
|
|
|
|
Try defining it as such:
<DllImport("kernel32.dll", CharSet:=CharSet.Unicode, ExactSpelling:=False, CallingConvention:=CallingConvention.StdCall)> _
Private Shared Function WritePrivateProfileStringA(ByVal lpApplicationName As String, ByVal lpKeyName As Object, ByVal lpString As String, ByVal lpFileName As String) As integer
End Function
and see if that works for you.
|
|
|
|
|
Your Declare statement is wrong. Try changing it to:
Declare Function WritePrivateProfileString Lib "kernel32" Alias "WritePrivateProfileStringA" _
(ByVal lpApplicationName As String, _
ByVal lpKeyName As String, _
ByVal lpString As String, _
ByVal lpFileName As String) _
As Integer
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
Perfect, works like a champ
|
|
|
|
|
Hello all,
How do you select the text in a datagrid with one mouseDown? Like Microsoft Access lets you select text by clicking and dragging. I have only managed to do this on the second click (after the textbox has been selected).
My text box is read only, and I want the user to be able to select a portion of text in a cell after only one click and drag operation (not a click and then a click and drag).
I appreciate any help...
Frank
|
|
|
|
|
Hi everybody,This is my first Q in this informative forum.
I'm a new student in VB.NET'so would someone help me please?
I've a project in VB.NET ,where I've SQLData base connected to my project through ADO.NET components, and it's records displayed in Textboxes.
My first question is :
How can I add a button to search specific records determined by two columns in this DB ,and that must be by using one button.
for mor clarification:
when a user want to search the DB,s/he will have two choices according to two column chosen by this user , I and the name of these two columns e.g (patient'sName,patient'sNo)will appear whether on Checkbox or Radibutton and according to any choice the textboxes will represent the search parameters.
My project's code is under the namespace " System.Data.Oledb" .
My second question is :
What is the best technique uesed to make a connection to a DB in Vb.net, the ADO.NET(oledb) provided Data in VB.NET or using a code for each task and command? why?
I would be thankful for you.
|
|
|
|
|
Deema Jack wrote: How can I add a button to search specific records determined by two columns in this DB ,and that must be by using one button.
Add a button. Add a handler. Write a stored proc that does the search based on the two fields. Call the stored proc, using the values of the text boxes, and show the result.
Deema Jack wrote: What is the best technique uesed to make a connection to a DB in Vb.net, the ADO.NET(oledb) provided Data in VB.NET or using a code for each task and command? why?
I'm not sure how you'd 'use a code for each task and command' ? Basically, the best thing to do is to create connections late, release them early. .NET has it's own connection pool. It works best if all your users log into the database with the same user/password ( so permissions are handled within the DB, not at login ).
Christian Graus - Microsoft MVP - C++
|
|
|
|
|
Thanks Christian, but I tried many ways but I failed . Would you tell me please what is the code?
This is my form code:
B1 is to display the first record , B2 for the next one,B3 for the previous one& B4 for the last one. B8 is to make a search by one way,just by (PatientsNo),.So what is the code to make the search by two ways (patientsNo & PatientsName)?
Imports System.Data.OleDb
public Class Form1
Inherits System.Windows.Forms.Form
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Me.BindingContext(DataSet11, "PatientsTable").Position =0
End Sub
Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
Me.BindingContext(DataSet11, "PatientsTable").Position=+1
End Sub
Private Sub Button3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button3.Click
Me.BindingContext(DataSet11,
"PatientsTable").Position -= 1
End Sub
Private Sub Button4_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button4.Click
Me.BindingContext(DataSet11, "PatientsTable").Position = BindingContext(DataSet11, "PatientsTable").Count - 1
End Sub
Private Sub Button8_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button8.Click
Dim selcom As New OleDbCommand()
Dim drobj As OleDbDataReader
selcom.Connection = OleDbConnection1
selcom.CommandText = "select* from PatientsTable where(PatientsNo= " & TextBox1.Text & ")"
OleDbConnection1.Open()
drobj = selcom.ExecuteReader
If drobj.Read Then
TextBox1.Text = drobj.GetValue(0)
TextBox2.Text = drobj.GetValue(1)
TextBox3.Text = drobj.GetValue(2)
TextBox4.Text = drobj.GetValue(3)
TextBox5.Text = drobj.GetValue(4)
TextBox6.Text = drobj.GetValue(5)
TextBox7.Text = drobj.GetValue(6)
Else
MsgBox(" The record isn't exist")
End If
OleDbConnection1.Close()
drobj.Close()
End Sub
Private Sub Button10_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button10.Click
DataSet11.Clear()
OleDbDataAdapter1.Fill(DataSet11, "PatientsTable")
End Sub
Private Sub Button12_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button12.Click
Close()
End Sub
ePrivate Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
End Sub
|
|
|
|
|