|
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?
|
|
|
|
|
Would you mind posting a small code snippet, please?
|
|
|
|
|
HI Yone!
Thanks for your help. I'm still puzzled. Here is the thing..
The test buttonpress routine below calls the backgroundworker which then prints to the textbox using the delegate. This works fine.
However, the same call from the application sub does not invoke the delegate!
'THIS IS THE SUB THAT CALLS THE WRITETOLOG FUNCTION FROM ANOTHER CLASS
Public Class Application
Public Sub onLogon()
Implements QuickFix.Application.onLogon
Form1.WriteToLog("Logon Successful")
End Sub
End class
'THIS IS THE CLASS THAT HAS THE TEXTBOX
Public Class Form1
Public Function WriteToLog(ByVal Whattowrite)
'THIS WORKS FINE IF CALLED FROM BUTTONPRESS BELOW
'THIS IS IGNORED IF CALLED FROM APPLICATION CLASS SUB ABOVE
If TextBox1.InvokeRequired Then
TextBox1.Invoke(New TextDelegate(AddressOf SetText), _
TextBox1.Text & Whattowrite & vbCrLf)
End If
If Not TextBox1.InvokeRequired Then
TextBox1.Text = TextBox1.Text & "Not" & Whattowrite &
vbCrLf
End If
End Function
Sub SetText(ByVal Text As String) 'Declared Somewhere
TextBox1.Text = Text
End Sub
Delegate Sub TextDelegate(ByVal Text As String) 'Declared Somewhere
'BELOW IS ROUTINE TO TEST THE WRITETOLOG FUNCTION FROM A
BACKGROUND THREAD (WORKS FINE)
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e _
As System.EventArgs) Handles Button1.Click
BackgroundWorker1.RunWorkerAsync()
End Sub
Private Sub BackgroundWorker1_DoWork(ByVal sender As _
System.Object, ByVal e As _
System.ComponentModel.DoWorkEventArgs) _
Handles BackgroundWorker1.DoWork
WriteToLog("From BWorker")
End Sub
|
|
|
|
|
When your calling the sub onLogon() it calls the WriteToLog() method on another Form1 Class, (its just a class as any other class) You need to somehow pass a reference to the original Form1 class that was created when your application started to the Application Class, and call WriteToLog() on that reference.
Code might look like this:
'Class Declaration
<br />
Public Class Application<br />
Public frm As Form1 = Nothing<br />
<br />
Public Sub onLogon()<br />
If frm IsNot Nothing Then frm.WriteToLog("Hello from Application class")<br />
End Sub<br />
End Class<br />
'From any sub or other thread:
<br />
Dim a as New Application<br />
a.frm = me<br />
a.onLogon<br />
I tested it and it worked in my test setup
|
|
|
|
|
I'm using Crystal Reports in my vb.net project, for some reason this version of Crystal Reports is designed to disable mouse scroll or keyboard scroll. Is there any way I can enable the scroll by writing some code, because the only other way to enable the scroll is to do an upgrade.
Thanks,
Zee
|
|
|
|
|
Dim ParamSeparator() As String = {"GIF89a"}<br />
Dim gif As String = File.ReadAllText(OpenFileDialog1.FileName)<br />
For Each files As String In gif.Split(ParamSeparator, StringSplitOptions.None)<br />
<br />
Next
I wrote this code but it didn't work with Binary Files, so i want to know how to edit it for make working with Binary FIles.
Thanx for any help
|
|
|
|
|
Why did you do this when I told you what to do the last time you asked this question ?
Christian Graus - C++ MVP
|
|
|
|
|
Hello
I am makeing a quiz application and I am haveing problem with randomize
In multiple section I put 4 options and 3 is wrong answers and 1 is right answer so i randomize the questions but i also want to randomize the answers in lebels boxes so any help how to ransomize the answers
i used arrays for example how i create quiz
qus(0)="This the question ?" : ans1(0)="A" : ans2(0)="B" : ans3(0)="C" : ans4(0)="D"
thet's how i create array to display questions and it's options
and i put 4 buttons and 4 labels in front of it
and answers display in labels
lblA.txt = ans1(I)
lblB.txt = ans2(I)
lblC.txt = ans3(I)
lblD.txt = ans4(I)
any help please
|
|
|
|
|
Random.Next is how you get random numbers.
Christian Graus - C++ MVP
|
|
|
|
|
Hello
First of all thank you very much for your kind rep
I have allready done randomuzation for this quiz and it's working ok but i also want to randomize possible answers in label box at this time it's all comeing in same place every time like lblA = a , lblB = b , lblC = c , lblD = d , but i want to randomize the 4 possible answers in label box i dont want answer "a" in lblA every time
please have a look my first post
wating for your kind rep.
have a nice time
|
|
|
|
|
So, you need to shuffle the four answers. One way to do this is to build an array of answers, and grab them out of htere at random, to fill the four spots.
Christian Graus - C++ MVP
|
|
|
|
|
Hello
Thank you very much for quick rep.
this is my question and answer array
'get questions and answers arrays
Question(0) = "Macadamia and almonnd are types of what ?" : Ans1(0) = "Nuts" : Ans2(0) = "Fruit" : Ans3(0) = "Tree" : Ans4(0) = "Vagetable" : Clue(0) = "Do you know about any magazine ?" : CorrectAns(0) = "Nuts"
Question(1) = "In astrology the star sign Piseces is represented by which animal ?" : Ans1(1) = "Donkey" : Ans2(1) = "Fish" : Ans3(1) = "Lion" : Ans4(1) = "Snake" : Clue(1) = "It,s very testy" : CorrectAns(1) = "Fish"
Question(2) = "Where is Tower bridge ?" : Ans1(2) = "USA" : Ans2(2) = "Dubai" : Ans3(2) = "London" : Ans4(2) = "India" : Clue(2) = "Sterling" : CorrectAns(2) = "London"
Question(3) = "Where is liberty statue ?" : Ans1(3) = "India" : Ans2(3) = "London" : Ans3(3) = "Dubai" : Ans4(3) = "USA" : Clue(3) = "NY" : CorrectAns(3) = "USA"
Question(4) = "In geography where is Mount Fuji ?" : Ans1(4) = "Japan" : Ans2(4) = "Taiwan" : Ans3(4) = "China" : Ans4(4) = "USA" : Clue(4) = "It's very small country " : CorrectAns(4) = "Japan"
but i tryed lot but still i am strugling
wating for your kind rep.
have a nice time
thank you
|
|
|
|
|
Well, sure it is. Did you try what I suggested ?
Anyhow, your structure sucks. Ans1 and Ans2 are different arrays ? You have an array of answers for the first spot, but the four answers that go with a question do not relate to each other ? You should have one array of a struct, with the four answers, and the correct one.
Then you get an array of four numbers, 0 to 3. You get a random number between 0 and 3, and you grab the index in this array of that number. That's the index for position one. You remove that number from the number array, get a random number between 0 and 2. Get hte number at that index. That's the index to show next. Etc.
Christian Graus - C++ MVP
|
|
|
|
|
Hello Sir
thank you very very much
I got it
and thank you very much for your very quick rep.
thanks again for this
byyyyyyyy
|
|
|
|
|
I am trying to populate a datagrid using a SQL select statement. The statement contains a "WHERE fieldname LIKE textbox.text" as below in my code. The problem is, I can't get the code right to display the data in the grid when the button is clicked. Here is my code so far:
Public Sub loadDoc()
Dim DAdapt As SqlDataAdapter
Dim custMap As DataTableMapping = DAdapt.TableMappings.Add("Table", "DocumentList")
custMap.ColumnMappings.Add("Title", "Title")
custMap.ColumnMappings.Add("Expiration", "Expiration")
custMap.ColumnMappings.Add("Keywords", "Keywords")
Dim sql2 As String = "Select * FROM DocumentList WHERE Keywords LIKE '" & tbSearch.Text & "'"
Dim ds As New DataSet
DAdapt = New SqlDataAdapter(sql2, cnn1)
Me.cnn1.Open()
DAdapt.Fill(ds)
Try
grdDocumentList.DataSource = ds.DefaultViewManager
ds.Clear()
ds.Merge(ds)
grdDocumentList.SetDataBinding(ds, "DocumentList")
Catch eLoadMerge As System.Exception
Throw eLoadMerge
End Try
Me.cnn1.Close()
End Sub
Thank you,
LWhite
|
|
|
|