|
Something like that... That's the code you're not showing us, or what the code is around that little section.
Dave Kreskowiak
Microsoft MVP - Visual Basic
|
|
|
|
|
No, we can't. What is Form1 ? How is it set in this class ? How is the SplashSCreen instance created ? This is probably the problem, it's probably not a member variable, and is falling out of scope.
The code we need to see, has not been posted.
A progress bar that sets itself based solely on a timer is kind of useless.
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 )
|
|
|
|
|
Christian Graus wrote: A progress bar that sets itself based solely on a timer is kind of useless.
Well all it is there for is JUST FOR SHOW
|
|
|
|
|
Sure, but your splash screen has to be a member, that's almost certainly why it didn't work before, and then you can call a method to move the progress bar as the program loads. Or, don't have the progress bar, if it doesn't mean anything.
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 )
|
|
|
|
|
By my calculations your splash screen should stay up for approximatly 56 seconds. That can't possibly be what you intended. Anyway based on your code and description I would say you added a form to your project and selected 'splash screen'. This doesn't mean your application will start with a splash screen. In order for your application to start with the splash screen you need to set that form as your splash screen. To do that you'll need to go to the project properties and under the Application tab you should see 'Splash Screen' with a dropdown to select the desired form. You may have already done that but I couldn't tell if your form was displaying at all. However if you've gotten that far your form will still dissapear once form1 is loaded and the minimum display time has been met, whichever comes second. Since I get the impression your splash screen is simply ornamental I would just pick a time you want it to display. You can set the minimum time in the splash screens 'New' constructor. Use a timer to update the progess bar. The value will be the percentage of time elapsed * 100. So if you want to display for 3 seconds and the elapsed time is 2 secnods the value would be 66. Here's an example of what I mean.
Public NotInheritable Class SplashScreen1
'Minimum time in seconds to show this splash screen
Private Const DisplayTime As Integer = 5
WithEvents tmr As New Timer
Dim sw As New Stopwatch 'Stopwatch to track time since shown
Public Sub New()
' This call is required by the Windows Form Designer.
InitializeComponent()
'Set minimum time to display
My.Application.MinimumSplashScreenDisplayTime = DisplayTime * 1000
'Update progress every 10/1000 sec
tmr.Interval = 10
End Sub
Private Sub tmr_Tick(ByVal sender As Object, ByVal e As System.EventArgs) Handles tmr.Tick
'Calculate value for progess bar
Dim elapsed As Integer = (sw.ElapsedMilliseconds / (DisplayTime * 1000)) * 100
If elapsed > 100 Then elapsed = 100
ProgressBar1.Value = elapsed
End Sub
Private Sub SplashScreen1_Shown(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Shown
sw.Start() 'Begin stopwatch
tmr.Start() 'Start timer
End Sub
End Class
|
|
|
|
|
THANKS that works perfectly
And i can adjust the time to anything i like.;)
|
|
|
|
|
hello,
Does anybody have any idea why update doesn,t save updated fields. Code below runs OK. but doesn't save into CallerRecords table.
I am using VB.NET. thanks.
Here is the code:
Private Sub btnupdate_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnupdate.Click
Dim connectionString As String = "Provider=SQLNCLI;Server=A45292\SQLEXPRESS;DataBase=FSS;Trusted_Connection=Yes"
Dim sqlString As String = "SELECT * FROM CallerRecords Where RecordNo =" & TextBox2.Text
dbConn = New OleDb.OleDbConnection(connectionString)
dbConn.Open()
da = New OleDb.OleDbDataAdapter(sqlString, dbConn)
da.Fill(ds, "CallerRecords")
Dim tbl As DataTable
tbl = ds.Tables("CallerRecords")
Dim selectedRows() As DataRow
selectedRows = tbl.Select("RecordNo = " & TextBox2.Text)
If selectedRows.Length > 0 Then
selectedRows(0).Item("FirstName") = FirstNameTextBox.Text
selectedRows(0).Item("LastName") = LastNameTextBox.Text
selectedRows(0).Item("CallerPhone") = CallerPhoneTextBox.Text
selectedRows(0).Item("HospitalNumber") = TextBox1.TextEnd If
Dim myBuilder As OleDbCommandBuilder = New OleDbCommandBuilder(da)
myBuilder.GetUpdateCommand()
da.UpdateCommand = myBuilder.GetUpdateCommand()
da.Update(ds, "CallerRecords")
dbConn.Close()
MessageBox.Show("Database Is Updated")
programmer
|
|
|
|
|
Why should anyone tell you anymore? I've already told you twice that you don't have to do all this stuff, and I've given you the UPDATE SQL statement that you should be using in place of all this junk, and yet you still refuse to listen.
Dave Kreskowiak
Microsoft MVP - Visual Basic
|
|
|
|
|
i have made a tree structure and added parent and child nodes through property window(Collections).
nw i have make a click event for one of the child node...
at run time that event is activated by clickin any of the parent or child node of that tree....
hw can i make specifically for any node or parent...
|
|
|
|
|
You would do it like this:
If TreeView1.Nodes(0).IsSelected = True Then
'Put Events here
End If
0 is the Node Index.
Trinity: Neo... nobody has ever done this before.
Neo: That's why it's going to work.
|
|
|
|
|
Hello,
I am getting the following error when I click on update button from my form.
"incorrect syntax near 'Records'."
Code runs good all the way to the end and gives error where it says"
da.update(ds, "Caller Records") Caller Records is the name of the table and ds is a variable for the data adapter.
any idea why I am getting the error message. thanks
programmer
|
|
|
|
|
It's complaining that the SQL statement your using to do the update is incorrect.
Dave Kreskowiak
Microsoft MVP - Visual Basic
|
|
|
|
|
Hai,
I am new in vb.net. before this i'm using VB6.My question is,
how to insert (save) data from text file into database.
This is the senario:
data from text file is:-
123456789qwert
then, i want to save the data into database(name TEST) like this :-
a) 1234 -> field name ID
b) 56 -> field name IC
c) 789 -> field name KP
d) qwert -> field name Address.
In vb6 I used mid(temp x,x) to read the data from text file and insert into database but i have no idea how to do this in vb.net.
pls help me.
TQ
I'm just the beginner...
|
|
|
|
|
I had a little trouble getting started as well in vb.net, don't give up though!!
Try this
'add this to setup your sub
Private Sub YourWorkSub()
Dim oDB as ClsDb
Dim MyQuery as String
try
oDB = New ClsDb("YourServerNameOrIP", "YourDataBaseName")
MyQuery = "Selec into (field name ID,field name IC,field name KP,field name Address) Values(1234,56,789,'quert')"
oDB.ExecuteQuery(MyQuery)
catch e as Exception
MsgBox(e.Message)
EndTry
End Sub
'Add This part down as a class
Imports System.Data.SqlClient
Public Class ClsDb
Private m_sServerIP As String
Private m_sDatabase As String
Sub New(ByVal sServerIP As String, ByVal sDatabase As String)
m_sServerIP = sServerIP
m_sDatabase = sDatabase
End Sub
Private Function GetConnection() As SqlConnection
Dim oDBConn As SqlConnection = New SqlConnection("User ID=YourUserID;Pwd=yourpass;Data Source=" & m_sServerIP & ";Initial Catalog=" & m_sDatabase)
Try
oDBConn.Open()
Catch e As SqlException
Throw e
End Try
Return oDBConn
End Function
Public Sub ExecuteQuery(ByVal sQuery)
Dim oCmd As SqlCommand
Dim oConn As SqlConnection
Try
oConn = GetConnection()
oCmd = New SqlCommand(sQuery, oConn)
oCmd.Connection = oConn
oCmd.ExecuteNonQuery()
oConn.Close()
Catch e As SqlException
Throw e
End Try
End Sub
End Class
Hope This Helps Ya!!
|
|
|
|
|
Hi .TriGiggleMich Thanks for helping me.
Actully this is the case :-
Somebody email me a text file content data which i need to insert into database.The data must be insert into database based on the length that has been set.
1st three character insert into field name1.
4th and 5th character insert into filed name2.
Last time i'm using VB6 and this is my coding.
---------------------------
Dim rs As ADODB.Recordset
Dim SQL As String
Dim db As ADODB.Connection
Set db = New ADODB.Connection
db.CursorLocation = adUseClient
db.Open "Database connection"
Set rs = New ADODB.Recordset
SQL = "select * from database name "
rs.Open SQL, Cons, adOpenStatic, adLockOptimistic, adCmdText
CMD.Filter = "*.txt| *.txt|*.dat| *.dat "
CMD.ShowOpen
If CMD.CancelError = True Then
Exit Sub
End If
If (CMD.FileName <> "") Then
Text6 = Mid(CMD.FileName, 4)
End If
If (CMD.FileName = "") Then
Exit Sub
End If
Open CMD.FileName For Input As #1
Do Until EOF(1)
Screen.MousePointer = vbHourglass
Line Input #1, temp
rs.AddNew
rs!Q1 = Mid(temp, 1, 1)
rs!Q2 = Mid(temp, 4, 1)
rs.Update
Loop
Set rs = Nothing
rs.Close
Close #1
CMD.FileName = ""
Screen.MousePointer = vbDefault
-------------
Now I need to convert all this to VB.NET
I'm just the beginner... ;(
|
|
|
|
|
I have a text field where users can submit source code to my website. This field contain the mix of code and description. All source code will be enclosed within a special tag [CODE][/Code]
I am looking for the regular expression to do the following in VB.NET:
Replace all occurrences of [code] with <pre>
Replace all occurrences of [/code] with </pre>
Replace all linebreaks (vbCrLf) outside the [code][/code] blocks with <BR>
Replace all < inside the [code][/code] blocks with ∓
-- modified at 10:09 Saturday 24th February, 2007
|
|
|
|
|
<code>
Public Function Change_Text(ByVal strInText As String, ByVal strOutText As String) As Boolean
Dim strSubText As String
Dim intPos As Integer
Dim bolCode As Boolean = False
'Default as OK
Change_Text = True
'Clear output string
strOutText = ""
'Loop through string
Do Until strInText = ""
'Look for opening '['
If Mid(strInText, 1, 1) = "[" Then
'Find closing tag
intPos = InStr(2, strInText, "]")
'Extract content
strSubText = Mid(strInText, 2, intPos - 2)
'Skip text beyond end tag
strInText = Mid(strInText, intPos + 1)
'Check tag information....
Select Case UCase(strSubText)
Case "/CODE"
'Closing tag
strOutText += "</pre>"
'Flag outside code area
bolCode = False
Case "CODE"
'Opening tag
strOutText += "<pre>"
'Flag inside code area
bolCode = True
Case Else
'Unknown [] tag - Flag as error ...
Change_Text = False
End Select
ElseIf Mid(strInText, 1, 2) = vbCrLf Then
strInText = Mid(strInText, 3)
If bolCode Then
'Inside Code Tags
strOutText += "&mp;"
Else
'Outside Code Tags
strOutText += "<br>"
End If
Else
'Write character to output string...
strOutText += Mid(strInText, 1, 1)
End If
Loop
End Function
</code>
Call with ....
<code>
If Not Change_Text(TextBox.Text, strOutput) Then
TextBoxError.Text = "Invalid Information entered"
bolError = True
End If
</code>
Hope this helps....
|
|
|
|
|
Thank you. The above code will work, but I am looking for regular expression which can do the above in 1~3 lines and which would be nore efficient.
|
|
|
|
|
Is this easily done??
Thanks in advance
|
|
|
|
|
Hello,
I have a lot of controls and information to put on to one form. When this is run the form will be to big for the screen. This is the requirement so has to fit on one form.
Is there a way, maybe to add scroll bar to the form, or do something else?
Many thanks,
Steve
|
|
|
|
|
The forms don't have scrollbars. However you can immitate it with a panel object. I have explained below how to do this:
First, place a panel object on your form and set its size to form's size (Width and Height) or you can apply docking. Then in the Panel object's attributes enable the scrollbar for the panel object. And then place all other objects inside the panel object (Drag and Drop). That is how you can scroll and see all other controls inside a form.
Give a try... I hope that helps.
Journey
|
|
|
|
|
exactly u want to make yr form as big as u want ....
do one thing in property window turn the ' autoscroll' as TRUE.
then yr form will increase t the size accordin to yr buttons and textboxes....
try this out ..and lemme knw..
|
|
|
|
|
Perhaps you should consider using a tab control instead of a scrolling panel. That's what usually is used to get more into a form that there is room for, and in my opinion more user friendly.
---
single minded; short sighted; long gone;
|
|
|
|
|
Thanks for your response.
All your ideas are very good, and I will try all of them.
Thanks,
Steve
|
|
|
|
|
well i am through with dot net package...
and i have the acquaintance wid the technical approaches of dot net...
but being a beginner i come accross many small problems and errors which i dnt knw hw to resolve.
can anybody help in troubleshootin and giving me guiadance..
thanks..
regards..
|
|
|
|