|
Soooo, how many times a day are you going to ask this question? How long before you relize that it's very unlikely you're going to get an answer to it?? I for one, haven't used VB6 in 7 years.
|
|
|
|
|
What is this the 3rd or 4th time today? I mean I understood the second repost because the way he formatted his code was horrific, but now someone is desperately just avoiding google and alternative methods of research.
Stop the reposting, no one here is obligated to help you, and if they didn't by now, chances are it isn't going to happen.
|
|
|
|
|
VB6 is dead and was always a joke. Why are you using it ?
Christian Graus
Driven to the arms of OSX by Vista.
|
|
|
|
|
Hi everybody,
I'm VERY new to VB and need some guidance...it may be that I am just over complicating things by what I'm doing though - or what I am asking might not be possible - but here goes!!
I am writing a new app from scratch for my current employers and I have a few classes that are used to handle data access and management.
I have a class that represents a "Shop", so it has a shop number, address lines etc.
I have a seperate class called "Shops" which inherits from CollectionBase. The Items in Shops.List are populated by "Shop" objects. So I have a method called populatelist which uses a SqlDataReader to return a list of customer shops. I then traverse this list and create a "Shop" using field values in each datarow. I then Add(Shop) which populates my collection list.
This all seems to work fine.
However I want to connect my "Shops" collection to a combobox, so I tried code like the following: -
Dim aBind As New BindingSource
aBind.DataSource = oShopList
cboShopList.DataSource = aBind
cboShopList.DisplayMember = "ShopName"
cboShopList.ValueMember = "ShopNumber"
cboShopList.DataBindings.Clear()
cboShopList.DataBindings.Add("SelectedValue", aBind, "ShopNumber")
This populates the combo correctly, and refreshes nicely when I change customer.
BUT when I test my combobox, I get erratic results. I test what value the combobox returns and it changes sometimes when I change the selection, sometimes not. Whichever item I pick in the list, the display part of the combo always displays the first item after briefly displaying the item I chose...even when it sometimes changes the ValueMembers value...
I am using VB.Net 2.0 and the app is your bog standard, run-of-the-mill windows application.
Like I say, I'm new so not sure if I am way off beam here, but any advice at this point would be helpful!
Cheers,
A seriously LostMonkey...
|
|
|
|
|
LostMonkey wrote: I have a seperate class called "Shops" which inherits from CollectionBase.
Why not just use a list of shops ? What does using your own class give you ?
What is a bindingsource ? Why do you need that in the middle ? Your datasource should work just pointing to your list.
I also don't see why you need the DataBindings. What do they do ? I'd just set the datasource to oShopList, and set the Display and Value members.
Do you know other languages and you're new to VB ? What other languages do you know ?
Christian Graus
Driven to the arms of OSX by Vista.
|
|
|
|
|
I have just started creating a new vb application which requires a login screen.
I have created a new database in sql server 2000 which holds the usernames and passwords.
I was wondering how i would create the connection and then link the username and password text boxes to the fields in the database.
Regards.
David
|
|
|
|
|
Do you have any code to show what you've attempted thus far?
Any suggestions, ideas, or 'constructive criticism' are always welcome.
"There's no such thing as a stupid question, only stupid people." - Mr. Garrison
|
|
|
|
|
Public Class
Private sqlConn AS SQLConnection = New Sql Connection (connectionstring)
Private sub LoginScript()
SqlConn.open
DIM SqlCmd AS New SQLCommand = (StoredProcdure, SqlConn)
Dim SqlAdapter as sqldataadapter = new sqlAdapter(sqlCmd)
Dim dt as new DataTable
SqlAdapter.fill(dt)
IF dt.select("username = " +txtUserName.text + "AND password = " + txtPassword.text) > 0 THEN
'login
Else
msgbox("Login Failed", "Login Failed", vbOK)
END IF
END sub
|
|
|
|
|
I would highly recommend picking up a book on VB.NET and SQL Server and working through them before taking this project on. The code you're written so far is terrible and if you continue to use the techniques you've demonstrated so far, your project is going to fail miserably.
Amazon results[^]
|
|
|
|
|
I have recently read a VB book, as you can imagine, i am a complete novice when it comes to vb and programming. I have written this piece of code. I was wondering if you could tell me if this would create a valid connection or not.
Imports System
Imports System.Data
Imports System.Data.SqlClient
Public Class frmLogin
Public sqlconnection As SqlConnection = New SqlConnection("Data Source=TG-IT-TPSRV;Initial Catalog=AFQ;User ID=sa;Password=;")
Public Sub frmLogin()
Dim sqlConn As SqlConnection = sqlconnection
Dim sqlComm As String = ("SELECT * FROM Users")
End Sub
Private Sub BtnCancel_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnCancel.Click
Me.Close()
End Sub
Public Sub Logon_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
End Sub
Private Sub BtnOK_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnOK.Click
Dim sConnectionString As String = "Source=TG-IT-TPSRV;Initial Catalog=AFQ;User ID=sa;Password=;"
Dim objConn As New SqlConnection(sConnectionString)
Dim sqlComm As String = ("SELECT * FROM Users")
Dim objComm As New SqlCommand(sqlComm, sqlconnection)
objConn.Open()
End Sub
End Class
|
|
|
|
|
Yeah, it would create a connection, but your design is going to cause you problems down the road.
|
|
|
|
|
Hi!
Have made an application in vb.net visual studio 2008.
Need some help to use a splash screen, that waits for about 4 seconds before it
show the main form. And of course close the splash screen...
Have Added the splash screen to my project, but thats it.
And the splash screen is loaded, but need to set timer and to start the main form..
Please help me with example source on this one..
Thanks
|
|
|
|
|
On your main mdiForm in the Load event show the splash screen
Private _splash As SplashScreen
Sub Form_Load() Handles Me.Load
_splash = New SplashScreen
_splash.Show(Me)
End Sub
Then in the Shown event close the splash Screen
Sub Form_Shown() Handles Me.Shown
_splash = New SplashScreen
_splash.Close
_splash.Dispose
_splash = Nothing
End Sub
Steve Jowett
-------------------------
Real programmers don't comment their code. If it was hard to write, it should be hard to read.
|
|
|
|
|
2008? There's a Splash Screen component built in. All you have to do is right-your project in the Solution Explorer, and click Add New Item... It's in the list that shows up. Everything is already done for you.
|
|
|
|
|
Thanks You
when apllication in on that time first the splash screen show and hold for a moment than after the mdiform to display that are not happen please if u have a solution so please help me and if u have a code so that's also give it please
|
|
|
|
|
I already gave you the solution.
|
|
|
|
|
i want's to ask that i can hold splash screen for a 5 second and all other this are done but the splash screen can't hold for some moment i want to try but that's not work please help for that propblem
thanks
|
|
|
|
|
Show your splash screen form and then call Thread.Sleep(5000) .
|
|
|
|
|
thank for this advices but...
That's also i done but on that time the splash screen are not look proper
that's look like some process are happen hear that's not possible other wise i will give u printscreen but when i will try but on the process are occoure so the splash screen are not show in that printscreen only the backgroud are show
|
|
|
|
|
You didn't use the SplashScreen component, did you?
|
|
|
|
|
I use the Slash Screen Componet
Hear We put the what to do i in my project
1) Add the Splash Screen component in my Project
2) That's define as StartUpForm
3) Than i Code in Splash Screen that's below
remarks : form1 is mdiform
Dim showForm As New Form1
Me.Show()
Me.Activate()
System.Threading.Thread.Sleep(5000)
showForm.ShowDialog()
4) if i didn't Write the me.show the splash Screen form are not show that's the me.show and me.active are define
5) in that time the splash screen are show but that's display not perferct that's look like when some process are occoure in backgroud i want's to display splash screen in perfect
please help me
|
|
|
|
|
hi can u suggest me that the tools for converting vb source code to vb.net.
|
|
|
|
|
You really should start again and rewrite from scratch, to ensure you take full advantage of the .NET Framework and the OO capabilities.
Steve Jowett
-------------------------
Real programmers don't comment their code. If it was hard to write, it should be hard to read.
|
|
|
|
|
thnx Steven but i dnt have tht much of time its urgent so i m trying for conversion tool
|
|
|
|
|
Why is it urgent to convert it? If you need to urgently add something, do it in VB.
The best way to accelerate a Macintosh is at 9.8m/sec² - Marcus Dolengo
|
|
|
|