|
Yea the more I mess with these xml files the more I realize I should just have a DB. So when you refer to "a remotable component that manages the database" you mean a VB interface to add/edit the logs?
How can the "clients" connect to the DB - a connection string to the SQL DB? and once they have connected is there events in the DB for when it get updated? (I am not going to be able to have a full version of MS SQL but I know they offer a express version for free).
It would be nice to just have 1 vb interface everyone installs with a connection path to the DB and I can resolve ownership so i can restrict who can add/edit.
Thanks - this helps a lot to clarify - so many things to look at this weekend
|
|
|
|
|
commieJerk wrote: So when you refer to "a remotable component that manages the database" you mean a VB interface to add/edit the logs?
Something like that. Try wrapping your brain around this[^], then Google for "VB.NET CAO remoting singleton" for some more docs and examples. Basically, you're writing a server that your clients will connect to and the server connects to the database. Your clients will never see the database itself.
|
|
|
|
|
Hi all.
I'm making a program in VB 2005 express edition and now i wanna make a picture appear for some seconds and then disappear. how can i do that?
thks in advance.
|
|
|
|
|
Put your picture on a form and display the form as per normal, using a timer event to close the form after the prescribed number of seconds.
---------------------------------------------------------
Damian - Wondering what to write here...
|
|
|
|
|
The easiest way is to add a picture box and then add a timer to hide it again.
Christian Graus - Microsoft MVP - C++
"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 )
|
|
|
|
|
ok, i was thinking the same, but the problem is, i dont knwo how to work with it..
|
|
|
|
|
I recommend buying a book on VB.NET if you don't know how to use timers or controls.
Christian Graus - Microsoft MVP - C++
"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 )
|
|
|
|
|
but could you give me an exemple on how to set up a timer?
for exemple: open an image, and after 5 seconds close it..
|
|
|
|
|
Timer timer = new Timer();
timer.Interval = 5000;
timer.Tick += delegate { myPictureBox.Visible = false; timer.Stop(); };
timer.Start();
This will hide myPictureBox in 5 seconds.
Christian Graus - Microsoft MVP - C++
"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 )
|
|
|
|
|
Up until now, I've always used a single form along with it's vb code(Form1.vb & Design). I now have a project where two forms are needed. I added a second form so now I also have (Form2.vb & Design). I want to access the 2nd form from a button on the 1st form and visa versa like a hierarchical menu system. Is it necessary to have a parent and child form relationship if I only want one of the forms accessed at any given time? Both forms will have independent vb code, but I will need to use a value created on form one in form two's vb code. I was going to hide each form that is not in focus at the time. What is the best approach for something like this?
MSH
|
|
|
|
|
MARKSHAM wrote: Is it necessary to have a parent and child form relationship if I only want one of the forms accessed at any given time?
No, the sensible thing to do here is to design both forms as user controls, put them on the one form, and switch which one is visible, at the press of a button.
Christian Graus - Microsoft MVP - C++
"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 )
|
|
|
|
|
Thanks for the suggestion. I'm new to VB and OOP so I'm going to have to look up user controls. Thanks again for leading me in the right direction.
MSH
|
|
|
|
|
Hi all,
I would be really thankful to you all if I could help me to slove my the following problem.
I've written following code to tokenize my string in VB.NET which use " " i.e space as delimiters.
Dim data(100,100) as string
Dim value As String = "&&&&&&&&&&&&&& Tech&&&&&&&&&Repu &&&& blic.com" # Input string where & is a space. I used & as space while posting message since space was ignored while posting message
Dim pattern As String = " " # delimiters
sites = value.Split(pattern)
k = 0
For Each s In sites
If s <> pattern Then
data(0, k) = s
outFile.WriteLine(data(0, k))
k = k + 1
Else
MessageBox.Show(" Space found")
End If
Next s
According to my understanding, the program should ignore the space and assign
data(0,0)=Tech
data(0,1)=Repu
data(0,2)=blic.com
But unfortunately, else part of code is never executed and some spaces are stored on dataarray along with the string.
Can anybody help me to achieve me my goal or any other advise for me?
My Goal is to assign:
data(0,0)=Tech
data(0,1)=Repu
data(0,2)=blic.com
hsprasain
|
|
|
|
|
Because your using spaces as your delimiter it was probably hard to notice but the values that will be contained in 'sites' are not spaces, they are empty strings. Take a look at this code:
Dim value As String = "A,,B,C"
For Each s As String In value.Split(","c)
Console.WriteLine(s)
Next
You'll notice the values returned by the split function are 'A','','B','C' where '' is an empty string. It doesn't return the delimiter. In your loop you should test that the string is not empty.
|
|
|
|
|
Thanks a lot friend!!! I appreciate your help. It works well now.
|
|
|
|
|
Also you could use a regular expression to do the splitting. It will allow you to remove all the white space between values so you only get the actual text. Take a look at this.
Dim value As String = "A B C"
Dim regex As New System.Text.RegularExpressions.Regex("\s+")
For Each s As String In regex.Split(value)
Console.WriteLine(s)
Next
|
|
|
|
|
Hey,
I'm creating a program that can control my media player.
My keyboard has special buttons like play, pause, next, previous and they work with every program.
How can I do this in vb.net?
Greets,
Stijn Janssen
|
|
|
|
|
The same way you would hanld e any other keypress on your form. Enable the KeyPreview property on your form, then in the form's KeyDown event, check for the appropriate key. You can find the list of Keys in the docs for the Keys Enumeration[^] docs.
|
|
|
|
|
Hello,
VS 2005
My program will download files from a server that is on a local network. I would like to monitor the download by using the progress bar.
Currently the files are downloaded using a separate thread. I am just wondering how would I display a progress bar, as the progress bar will be on the UI thread and the files will be downloaded on a separate thread.
The method I use to start my thread to download the files is as follows.
<br />
_updaterThread = New Thread(New ThreadStart(AddressOf _updater.StartUpdater)) <br />
_updaterThread.Start()
I am thinking of having another windows that will popup with the progress bar and monitor the download from there.
So the user will click on a button on the form, this progress bar window will display showing the current download progress.
Many thanks for any code or suggestions to get my going.
Steve
|
|
|
|
|
This might help
http://support.microsoft.com/kb/315577
|
|
|
|
|
First the setup
My Code:
<br />
Imports System.Data.SqlClient<br />
Imports System.Text<br />
Public Class Form1<br />
<br />
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click<br />
<br />
Dim myConnection As New SqlConnection()<br />
Dim myDataSet As New DataSet()<br />
Dim myDataAdapter As SqlDataAdapter<br />
Dim myUpdateCommand As SqlCommand<br />
Dim myNewStr As String<br />
<br />
'create connection string<br />
myConnection.ConnectionString ="Server=.;Database=TestDB;UID=steve;pwd=password;Trusted_Connection=yes;"<br />
<br />
'open connection to DB<br />
myConnection.Open()<br />
<br />
'setup data adapter <br />
myDataAdapter = New SqlDataAdapter("select TEXT from SCRIPTS WHERE ID=1", myConnection)<br />
<br />
'Initialize the SqlCommand object that will be used as the DataAdapter's UpdateCommand.<br />
'Note that the WHERE clause uses only the CustId field to locate the record that is to be updated.<br />
myUpdateCommand = New SqlCommand("UPDATE SCRIPTS SET TEXT=@pNewText FROM SCRIPTS WHERE ID =@pMyID", myDataAdapter.SelectCommand.Connection)<br />
<br />
'Create and append the parameters for the Update command.<br />
myUpdateCommand.Parameters.Add(New SqlParameter("@pNewText", SqlDbType.VarChar))<br />
myUpdateCommand.Parameters("@pNewText").SourceVersion = DataRowVersion.Current<br />
myUpdateCommand.Parameters("@pNewText").SourceColumn = "TEXT"<br />
<br />
myUpdateCommand.Parameters.Add(New SqlParameter("@pMyID", SqlDbType.Int))<br />
myUpdateCommand.Parameters("@pMyID").SourceVersion = DataRowVersion.Original<br />
myUpdateCommand.Parameters("@pMyID").SourceColumn = "ID"<br />
<br />
<br />
'Assign the SqlCommand to the UpdateCommand property of the SqlDataAdapter.<br />
myDataAdapter.UpdateCommand = myUpdateCommand<br />
<br />
'call the fill method to populate our dataset<br />
myDataAdapter.Fill(myDataSet, "SCRIPTS")<br />
<br />
'present the current entry in database<br />
MsgBox("Script before updating" + vbCrLf + Encoding.Unicode.GetString(myDataSet.Tables("SCRIPTS").Rows(0)("TEXT")))<br />
<br />
'modify current with replace to update field<br />
myNewStr = Replace(Encoding.Unicode.GetString(myDataSet.Tables("SCRIPTS").Rows(0)("TEXT")), "hello", "steve")<br />
<br />
'now convert our replaced field to a byte array<br />
Dim dBytes As Byte()<br />
dBytes = StrToByteArray(myNewStr)<br />
<br />
'set the dataset table row to our converted byte array<br />
myDataSet.Tables("SCRIPTS").Rows(0)("TEXT") = dBytes<br />
<br />
'call the update method to write back to DB<br />
myDataAdapter.Update(myDataSet, "SCRIPTS")<br />
<br />
'close connection<br />
myConnection.Close()<br />
<br />
End Sub<br />
<br />
Public Shared Function StrToByteArray(ByVal str As String) As Byte()<br />
<br />
'converts string to byte array<br />
Dim encoding As New System.Text.ASCIIEncoding()<br />
Return encoding.GetBytes(str)<br />
<br />
End Function<br />
<br />
End Class<br />
DB SETUP
-----------
Column Name Data Type
ID int (primary key)
TEXT image
DB Records:
ID=1
TEXT =
1040101010801080111033013010010301110111010009801210101033013010083011609701140116033013010010201050110011501050104033013010010401010108010801110330
(
when converted to string is:
hello!
goodbye!
Start!
finsih!
hello!
)
My code works perfect up until the point of the update method
myDataAdapter.Update(myDataSet, "TP_SCRIPTS")
Once I hit this line, i get an error saying :Failed to convert parameter value from a Byte[] to a String.
Help please!
-steve
|
|
|
|
|
svanwass wrote: 'Create and append the parameters for the Update command.
myUpdateCommand.Parameters.Add(New SqlParameter("@pNewText", SqlDbType.VarChar))
You created this parameter as a string, not as a binary type. This is where the error is comming from.
|
|
|
|
|
I am working on a project trying to get my DB and VB.NET skills up to speed. I have established a connection to my database and linked a combobox to the database thusly:
ComboBox1.DataSource = techDataSet.Tables("tblEmployee")
ComboBox1.DisplayMember = "EmployeeName"
However this puts the first record into the "textbox" portion of the ComboBox. I would prefer the ComboBox "textbox" portion to be empty and all the database information be in the dropdown...
Any help would be appreciated.
My goal in life is to be the kind of person my dog thinks I am.
|
|
|
|
|
All you need to do is set the SelectedIndex of the ComboBox = -1. That will take care of it.
|
|
|
|
|
Excellent,thanks.
My goal in life is to be the kind of person my dog thinks I am.
|
|
|
|