|
use the control collection and add an event to each textbox calling the same routine
|
|
|
|
|
Hi
You Can Make An "User Control" For Problem Such This. or If Posible You Can Use Array. If You Make Array TextBox Your Code Will Be Same This :
Private Sub Text1_Change(Index As Integer)
If Val(Text1(Index).Text) > 45 Then Text1(Index).Text = 45: MsgBox "Please Enter A Number Between 0 to 45", vbCritical
End Sub
Private Sub Text1_KeyPrees(Index as integer,KeyAscii as integer)
Same Last Code
End Sub
|
|
|
|
|
Hi,
I have an existing VB.Net application which loads selected Crystal XI reports and passes parameter values to the report from controls on the User's GUI. The code looks at the properties of each parameter field and determines its type, current values, default values etc and presents the appropriate interface to the user for parameter input. I am having trouble accessing or even identifying dynamic parameter lists which I want to refresh and present to the user for selection in a ComboBox or similar. I have several static lists which work fine. Is this a version issue? Are Dynamic ( and cascading ) parameters supported in .NET?
Nas
|
|
|
|
|
Hi all, I started learning VB.NET a few months ago and I love it.
What I'm having trouble with though is that I'm trying to assign a picturebox to a listbox so that the picture changes when selecting another item. But I can't figure out how. The pictures are in the project resource files, how do I assign them to the process? There's 78 pictures.
The form with the picturebox and listbox.[^]
Cheers!
|
|
|
|
|
Is your question about extracting the resources or assigning them to the picturebox
|
|
|
|
|
First, it depens on how you want to use resources. Are these embeded pictures as resources in your project or you are going to load them from references or from a specific directory.
What a curious mind needs to discover knowledge is noting else than a pin-hole.
|
|
|
|
|
Well what I want to do is; When the user selects an item in the ListBox, the PictureBox loads a file from the resources and displays it, and when the user selects another item, the PictureBox do the same procedure but gets another picture.
Since I've never used code to grab something from the resources, I have no clue on where and how I'm gonna load them. A friend of mine gave me this[^] link where it was described how a PictureBox could be used.
pictureBox1.Image = _<br />
new Bitmap(Assembly.GetExecutingAssembly(). _<br />
GetManifestResourceStream("PictureBoxControl.tinyemulator_res.jpg"))
The issue with this is that first Assembly is undefined and second that, well I have no freakin' idea on where the UI input should be. Is that enough to help me?
Cheers!
|
|
|
|
|
First do you have Imports System.Reflection at the beginning of your code, you need that to access the Assembly object. For the next part use the ListBox SelectedIndexChanged event, use the selecteditem value to index your resource file.
Hope that helps
|
|
|
|
|
Please check this link out http://msmvps.com/blogs/JayHarlow/default.aspx[^] It can give you an idea. If I were you, I would use embeded resources of course it is much easier to deal.
Also here is another approach:
<code>
The following example uses the ResourceManager.GetObject method to retrieve and display a binary resource (such as a graphic image).
…
Dim private rm As ResourceManager
rm = New ResourceManager("MyImages", Me.GetType().Assembly)
PictureBox.Image = Ctype(rm.GetObject("MyObject"), System.Drawing.Image)
…
</code>
-- modified at 16:24 Monday 12th March, 2007
What a curious mind needs to discover knowledge is noting else than a pin-hole.
|
|
|
|
|
im creating a form where users can login to a seperate form using a login name and password. I'm trying to compare the users imput for the login to a feild in MS Access and the same with password input in a seperate feild in the same table(PCBank.mdb). if input is correct go to form2.
if anyone can help it would be greatly appreciated. code below is my attempt
Imports System.Data.OleDb
Public Class Form1
Dim conn As OleDbConnection
Dim comm As OleDbCommand
Dim dr As OleDbDataReader
Dim da As OleDbDataAdapter
Private Sub connect()
conn = New OleDbConnection
conn.ConnectionString = "provider=microsoft.jet.oledb.4.0;data source=|datadirectory|\PCBank.mdb"
conn.Open()
comm = New OleDbCommand
comm.Connection = conn
comm.CommandType = CommandType.Text
End Sub
Private Sub DisplayRecord()
Me.txtid.Text = dr.GetString(0)
Me.txtpass.Text = dr.GetString(1)
End Sub
Private Sub btnlogin_Click(ByVal sender As
System.Object, ByVal e As System.EventArgs) Handles btnlogin.Click
connect()
comm.CommandText = "select * from Managers where id like '" & txtid.Text & txtpass.Text & "%'"
If txtid.Text = "Managers" = dr.GetString(0) And txtpass.Text = "Managers" = dr.GetString(1) Then
My.Forms.Form2.Show()
Me.Close()
End If
End Sub
End Class
|
|
|
|
|
peteyshrew wrote: Dim conn As OleDbConnection
Dim comm As OleDbCommand
Dim dr As OleDbDataReader
Dim da As OleDbDataAdapter
Why would you make these members ?
peteyshrew wrote: comm.CommandText = "select * from Managers where id like '" & txtid.Text & txtpass.Text & "%'"
You're truncating the username and password in to one string and using LIKE. What you should be doing is doing a select that checks if a record exists with exactly the username and password that were entered, so the real username and password never get pulled out of the database.
Christian Graus - Microsoft MVP - C++
Metal Musings - Rex and my new metal blog
"I am working on a project that will convert a FORTRAN code to corresponding C++ code.I am not aware of FORTRAN syntax" ( spotted in the C++/CLI forum )
|
|
|
|
|
I have have not look at this in detail but does not msaccess require you use "*" as a wild card instead of the SQL "%"/
jhoga
|
|
|
|
|
I have hierarchical data that the user can make one of four choices about. The primary treeview manages @900 rows of data that collapsed to @100 groups.
I need to draw a tree view with a 'radio button group' where the radio buttons are related to the treeview node index.
I have made a User Control for the 4 radio button but can't quite figure out:
1) How to Position the radiobuttons to align with the tree view node
2) Linkage to connect the button data to the treeview node
i.e.
[a,b,c,d] tvNode1
[a,b,c,d] tvNode2
Each control is located on separate panels, panel 1 is for the radio buttons, panel 2 is for the Treeview. - Is there may be a better way???
TIA
Tom Hamilton
Sacramento, CA
|
|
|
|
|
I would start from an existing treeview control and set the the DrawMode-property to OwnerDrawAll, so you you don't have to bother about the complexicity of the positions. In this mode you can draw your buttons instead of the existing signs in the treeview. Does this help your problem?
|
|
|
|
|
In vb.net 2005.
I am wanting to say at form load that if a global value (strName) has not been used (i.e. has not been entered into), then load another form, how can i do this, i have tried:
If strName.length < 1
strName.Empty
Help!!!
|
|
|
|
|
better delete this one...you'll get yelled at for double posting
|
|
|
|
|
try this Code
If strName= Nothing Then
else
End If
|
|
|
|
|
Sorted now cheers
|
|
|
|
|
In vb.net 2005.
I am wanting to say at form load that if a global value (strName) has not been used (i.e. has not been entered into), then load another form, how can i do this, i have tried:
If strName.length < 1
strName.Empty
Help!!!
|
|
|
|
|
Public Class Common
public shared strName as string = String.Empty
End Class
Public Class Form1
private sub form_load(....)
if common.strname = string.empty then
common.strname = "hello"
End if
End Sub
End Class
|
|
|
|
|
I want to clarify what you are asking? Are you trying too check the value of a textbox control to see if it is null and if so then opening a different form? Or are checking to see if a control has been createded?
Jhoga
|
|
|
|
|
Im trying something like this:
If strName.IsNullOrEmpty Then frmTeachBasics.Show()
The strName is a global, but it is coming up with an error asking me to replace "strName with String"
|
|
|
|
|
Try If String.IsNullOrEmpty(strName) Then frmTeachBasics.Show
|
|
|
|
|
i have two forms , form 1 and form 2
if have given some value in textbox1 of form1, i want the same value to be displayed on label of form2...
please help..
thanks
|
|
|
|
|
you can pass the pointer of the label of form1 to form2 and have it update in the textchange event or leave event.
|
|
|
|