|
okok.. Thanks a lot..
|
|
|
|
|
Just enter it anywhere in the code before you actually show the datagrid to the user.
Alternatively you can use this function, that will also lock you dataset for added protection. Just call it before you show your datagrid to the user.
<br />
Private Function ColumnLock(ByVal key As Boolean)<br />
Try<br />
Dim col As DataColumn<br />
YourDataGrid.DataSource = YourDataSet<br />
YourDataGridPA.SetDataBinding(YourDataSet, "YourTableName")<br />
YourDataGrid.ReadOnly = key<br />
For Each col In YourDataSet.Tables(0).Columns<br />
col.ReadOnly = key<br />
Next col<br />
Catch Ex As Exception<br />
msgbox(Ex.message)<br />
End Try<br />
End Function<br />
Johan
|
|
|
|
|
I'm looking for a comprehensive list of properties and methods for the Windows Media player control so I can control it programmatically rather than letting the user muck with the controls. So far all I can find is methods and properties for older versions. I'm gonna keep searching Google, but if anyone knows any lists off hand, let me know.
Thanks.
PS. I'm using VB 6
"Go to, I’ll no more on’t; it hath made me mad." - Hamlet
|
|
|
|
|
|
Hi
I had a strange problem. I had incoroporated ActiveX webbrowser control in windows forms (using vs.net 2003). I had recorded some events like click occured on the browser and stored them in the datatable as rows(one row for each event). Now what i want to do is run all these rows one by one. My problem is that the documentcomplete as well as navigatecomplete2 events doesnt fire until the whole method written for the running the events is executed. It creates a problem like i am not able to get the refreshed page in document object after navigation to a new page. Any help will be appriciable.
Thanks & Regards
Gurmeet Singh
|
|
|
|
|
Does anyone help me on network programming with vb.net?
I started new project on database programming over the network.
My project is desktop base application (not web base application), I don't know your country call that desktop application but my country (Thailand) does.
I search on the internet and I found that I must use socket.
I understand the database programming but network I can't.
I try to apply the sample code from internet with my project but it's all fail.
I have tried this about 1 month.
If anyone can solve on this topic, please help me.
My project is manipulate data on client that follow this strp
1. Client send the request to server.
2. Server will query data from main database then generate a xml file and send it to client.
3. Client recieve the text file and update the local database.
4. Client manipulate data.
5. Client query updated data and generate a xml file then send it to server.
6. Server recieve the text file and update main database.
I don't connect the main database via notwork for security. I can check text file format and block it anyway.
P.S.
I'm a Thai student and my English language skill so weak, please try to understand my words.
Thank you very much.
Sitt
|
|
|
|
|
Hi Sitt,
We have a setup in our company that sounds similar to what you describe. We have a very simple approach that works very nicely.
Our client application contains code to create xml files, and other code that can read xml files. Same thing for the server application.
When the server app does something that should influence whatever happens on the client machines, it creates an xml file with the necessary data, and copies it to a shared or ftp folder.
The client app checks this folder on a regular basis, and when it finds an xml file it reads it, and does something with the data. When the client app does something that should influence the server, it creates an xml file of its own and puts it in the same (or another) shared folder. The server also checks the folder on a regular basis, etc.
This process is very easy to secure, and to create, but it is not very good if you need to have very fast traffic between clients and server.
Hope this helps you,
Johan
|
|
|
|
|
Dim dtrReader As SqlDataReader = cmdCommand.ExecuteReader()
Try
While dtrReader.Read()
lstViewBuyers.Items.Add(dtrReader(1))
End While
Finally
dtrReader.Close()
End Try
this is how i display one field from the database to the listview... but my problem is when i come to display one row/record from the database to the listview...
How can i display the whole record in the sql database to using listview control?
pls help
nothing is impossible.....
|
|
|
|
|
By using a string builder to build a string out of the data in the row, and then adding that.
(1) is returning the second column, you can access them by name or index ( name is more self documenting ), you can build the string any way you like. There's no way to make the string build itself.
Christian Graus - C++ MVP
|
|
|
|
|
one way but not a good way is concatinate all of your field together that the query result is become to 1 field e.g.
sql --> "select f1 + ' ' + f2 + ' ' + f3 + ' ' + f4 from TableName"
' ' is white space, f1 to f4 is field name
result --> "aaa aaa aaa aaa"
"bbb bbb bbb bbb"
"cccc ccc cc ccccc"
the output format is not order in column but it's ok if the data is name and surname
|
|
|
|
|
Hi,
I have solved this problem simply as follows:
lstViewBuyers.Items.Add(dtrReader(1) & "|" & dtrReader(2))
I.e. you just concatenate all the fields from the record into a string with a divider between the values.
Afterward, if you want to use any part of the record, selected from the listview, you just itirate through the string. The | character (ofcourse you can use any other character or string) serves as the divider. Something like this:
Dim divider As String = "|"<br />
Dim cut As Integer<br />
Dim TheBitYouNeed As String<br />
cut = TheBitYouNeed.IndexOf(divider)<br />
TheBitYouNeed= Mid(TheBitYouNeed, 1, cut)
Hope this helps you,
Johan
|
|
|
|
|
Hey, another way of doing this if you don't know the amount of columns in the table you are getting would be:
<br />
Try<br />
While dtrReader.Read()<br />
Dim lvItem As New ListViewItem(dtrReader(0))<br />
For i As Integer = 1 To dtrReader.FieldCount - 1<br />
lvItem.SubItems.Add(dtrReader(i))<br />
Next<br />
lstViewBuyers.Items.Add(lvItem)<br />
End While<br />
<br />
Finally<br />
dtrReader.Close()<br />
End Try<br />
Bsically the same thing, but since the data reader has field information on it, we just use that and create the sub items from the datareader starting at the 1 position. Have you thought of using a bindable list view?
You may want to check to see if nulls are coming back though, you may get exceptions when you get data from a datareader that has null values and try to add it to a list view item like this.
|
|
|
|
|
Excel can load a CSV. A CSV is just a file, it can't do ANYTHING, except represent data. If you open a .CSV file in Excel, it will open with each comma being a column.
Christian Graus - C++ MVP
|
|
|
|
|
|
I have no idea. You asked about a CSV. If you can get MySQL data into a CSV, Excel will jsut open it.
Christian Graus - C++ MVP
|
|
|
|
|
There are MySQL tools available that can export to CSV files. You might want to look at SQLYog, for one.
|
|
|
|
|
How do class work?
a simple question for you maybe but its hard for me to understand... pls i need ur help
nothing is impossible.....
|
|
|
|
|
I have no idea what you're asking. How do you mean ?
A class represents a unit of operation. Once you have a class, you can create an instance of that class ( or as many as you like ), and use it's methods to perform the operations that class defines, access it's properties to get access to the data that class contains, etc.
If that doesn't help, then you need to ask a more specific question. From what angle are you asking ? Have you done any coding yet ?
Christian Graus - C++ MVP
|
|
|
|
|
i already made one class but on how to use it from the other form i dont know.... my simple class is just to get the sum of two integers.
will you help a simple mind like me to understand how to use class?
nothing is impossible.....
|
|
|
|
|
I guess the important question is - what resources do you have that you will be able to proceed once I tell you ? Sounds like you need to buy a book and work through it.
If your class is called wotsit, then you do this:
Dim w as wotsit = new wotsit() ( because VB syntax is nasty. You can call it whatever you like )
w.CallAnyMethodHere
Christian Graus - Microsoft MVP - C++
Metal Musings - Rex and my new metal blog
|
|
|
|
|
i really appreciate your quick response... even though it sound really 'dumb' question, but you really do me a very big favor... thanks, i used your syntax and it really work..
nothing is impossible.....
|
|
|
|
|
I have an application that runs a secondary, child, thread. That secondary thread can write to a public data table bound to the main form. However, it cannot write to a public textbox on the main form. Why is that?
tia
|
|
|
|
|
Because .NET 2.0 blocks UI access between threads. You can turn this off, or use a WorkerThread ( from memory ), which sends messages to the main thread, where you can update your UI.
Christian Graus - C++ MVP
|
|
|
|
|
Windows Forms are not thread safe, since you want to update the textbox from another thread you will need to marshal the update method to the original thread (the main form thread) and execute the method there.
Code might look like this:
Delegate Sub TextDelegate(ByVal Text As String) 'Declared Somewhere
Sub SetText(ByVal Text As String) 'Declared Somewhere
Me.TextBox1.Text = Text
End Sub
'From second thread
If TextBox1.InvokeRequired Then TextBox1.Invoke(New TextDelegate(AddressOf SetText), "Hello")
'If calling from a second thread, create a bridge (Delegate) to a custom sub on the fly and tell the first thread to execute it through the safe bridge
Hope this clarifies something
|
|
|
|
|
Thanks, that's helpful... but....
Textbox1.invokeRequired returns false and yet
textbox1.text = "Hello"
still doesn't write to the textbox.
How can that be?
|
|
|
|