|
Just create a module level variable for the return value, have the thread set the value and expose the value as a third public property. In this scenario, the parent thread creates the class, sets the two input parameter property values, starts the secondary thread execution, and when the parent thread is notified that the secondary thread has completed, it can read the return value from a third public property.
Robert
|
|
|
|
|
I have a designed a form which contains 5 Textbox.I have done OlEdb connection as a source code.When i click save button,the data will not be sending to the database ..please help me
|
|
|
|
|
what error occurs...and if possible send me the code ur using for saving the data into database..i do my best for the solution of ur problem.
|
|
|
|
|
i have about 3 pages in my ms word document. i want to set first and third page to portrait and second page to landscape.
anyone can help me?
|
|
|
|
|
Can you tell me the diffrency between A(,) and A()() ?
Hung
|
|
|
|
|
A(,) is a two dimensional array. A(5,2) will always have 5 lots of 2 elements.
A()() is a jagged array. A(5)() will contain 5 arrays of type A, each can be a different size.
Christian Graus - Microsoft MVP - C++
|
|
|
|
|
Hello All,
I am trying to extend the GroupBox control. It compiles cleanly, but when I add a new control to a form (say GroupBoxNew) and then drag other controls onto its design surface, the other controls are added to the form's controls collection instead of to the GroupBoxNew controls collection.
Can anyone point me to what I am doing wrong? Thanks!
Have a great day!
j2associates_NO_SPAM_@yahoo.com
|
|
|
|
|
I don't know in detail your source code of the GroupBoxNew. However, I try creating GroupBoxNew simply by declaring a usercontrol which is inherited from GroupBox. As a result, I can manipulate on the GroupBoxNew like available GroupBox. I think that maybe you override some functions of the GroupBox during creating the GroupBoxNew. good luck to you! <vtalau>
|
|
|
|
|
Hi all,
I'm using VB.NET and I can read my XML into a dataset and display it into a DataGrid with no problem. But what I would like to do (if possible) is select certain elements via an id attribute.
For example, if my XML had the following nodes:
<br />
<mynode id="someid">innertext</mynode><br />
<mynode id="someid">someotherinnertext</mynode><br />
<mynode id="someid">more innertext</mynode><br />
<mynode id="someotherId">innertext</mynode><br />
How would I be able to display only those nodes with id="someid" and bind my dataset to my Datagrid.
Is this even possible to do or will I have to create another XML document to parse and hold only those specific nodes?
Any help would be much appreciated! Thanks.
|
|
|
|
|
My example got cut off...it was: if my XML had the following nodes:
<&mynode id="someid" > innertext </mynode>
<&mynode id="someid" >someotherinnertext </mynode>
<&mynode id="someid" >more innertext </mynode>
<&mynode id="someid" >innertext </mynode>
|
|
|
|
|
oops...and then another line:
<mynode id="someotherId" > more text </mynode>
A different id should be included! sorry!
Again...how would I select only those text values where id="someid" ?
|
|
|
|
|
I am making a small program. Actually on my form there are two comboboxes. From these two comboboxes, user specify the search criteria.
In first combobox, there are alphabets from A-Z. In second combobox, there are selection criteria like "search By Author", "search by publisher" etc.
I just show data in a datagird.
I use the following code.
''' This code is used for concatenation % sign to use in like operator'''''''
Dim var1
var1 = Me.ComboAlphabets.Text()
var1 = var1 & "%"
MsgBox(var1)
''''Gettiong values of combobox'''''''''''''
Dim searchby
searchby = Me.ComboSearch.Text()
MsgBox(searchby)
Dim da As New SqlClient.SqlDataAdapter("SELECT * from books where '" & Me.ComboSearch.text & "' like '" & var1 & "' ", cn)
Dim ds As New DataSet
If da.Fill(ds, "books") = Nothing Then
MsgBox("No Record Found")
Me.ViewBookGrid.Hide()
Else
ds.Clear()
Me.ViewBookGrid.Show()
Try
da.Fill(ds, searchby)
Me.ViewBookGrid.DataSource = ds.Tables(searchby)
Catch ex As Exception
MsgBox(ex.Message)
End Try
MsgBox("Records Found")
End If
Everything is run fine , but there is a problem in select query after the where clause. Actually i want to select those records from database which user has mentioned from combobox. Like if user select "Publisher name" from combo box, then it select record from "publishername" column only.
I use the query, it works 100% fine
'Dim da As New SqlClient.SqlDataAdapter("SELECT * from books where publihsername like '" & var1 & "' ", cn)
At "publishername", i want to mention combosearch.text values. Means if i select "Publishername" from combobox, then my query becomes.
'Dim da As New SqlClient.SqlDataAdapter("SELECT * from books where publihsername like '" & var1 & "' ", cn)
If i select "AuthorName", then my query becomes
'Dim da As New SqlClient.SqlDataAdapter("SELECT * from books where authorname like '" & var1 & "' ", cn)
I try a lot and use this query
Dim da As New SqlClient.SqlDataAdapter("SELECT * from books where '" & Me.ComboSearch.Text & "' like '" & var1 & "' ", cn)
But this query cannot fetch correct result. If i exclude me.combosearch.text from query and replace this with "publishername" or "authorname", then it works fine.
kindly tell me that how to refine this querty, so that it will work fine,
plz reply
eshban
EsHbAn BaHaDuR
|
|
|
|
|
eshban284 wrote:
Dim da As New SqlClient.SqlDataAdapter("SELECT * from books where '" & Me.ComboSearch.Text & "' like '" & var1 & "' ", cn)
You're putting quotes around the tablename. You shouldn't.
Also, LIKE doesn't do anything unless you put % on either side of the string. And finally, you're wide open for SQL injection attacks with this code.
Christian Graus - Microsoft MVP - C++
|
|
|
|
|
Christian Graus wrote:
Also, LIKE doesn't do anything unless you put % on either side of the string
% is the wildcard so having Like 'A%' searches for anything beginning "A" - it is not necessary to have the wildcard on either side.
|
|
|
|
|
Christian Graus wrote:
You're putting quotes around the tablename. You shouldn't.
I think you mean column name and not table name. And to clarify, you shouldn't be putting single quotes around the column name.
|
|
|
|
|
Hi,
Thank you for your reply. Now my code runs fine. I just exclude single quotes. As far as like operator is concerned, i concat the % sign with the alphabets like A,B or C etc.
Thank you
EsHbAn BaHaDuR
|
|
|
|
|
I have an Explorer-Style ListView and I use
ListView1.View = View.Details<br />
ListView1.View = View.LargeIcon<br />
ListView1.View = View.List<br />
ListView1.View = View.SmallIcon
to update the respective view.
I added the ability to view thumbnails with this code:
Dim fullPath As String
Dim di As New DirectoryInfo(fpath)
Dim fi As FileInfo
Dim i As Integer
fullPath = GetPathFromNode(TreeView1.SelectedNode)
ListView1.Items.Clear()
'*** Loop to get the "jpg" files
Try
For Each fi In di.GetFiles("*.jpg") ' if path will contain link files, change from jpg to lnk
ImageList3.ImageSize = New Size(96, 96)
Try
CreateThumbNail(fpath & "\" & fi.Name) ' This returns the thumbnail images
With ListView1 ' set the properties for for the ListView ListView1
.Items.Add(fi.Name, i)
.LargeImageList = ImageList3
.ForeColor = Color.Blue
.Scrollable = True
End With
Catch
Exit Try
End Try
i += 1
Next ' cycle through fpath until no more *.jpg.lnk files are found
Catch
MsgBox("No image files are located in this directory.", MsgBoxStyle.Exclamation, "Thumbnails")
Exit Try
End Try
Private Sub CreateThumbNail(ByVal filepath As String)
Dim myImage As New Bitmap(filepath)
Dim MyThumbNail As Image
'*** ThumbNail
MyThumbNail = myImage.GetThumbnailImage(96, 96, AddressOf Thumbnailabort, Nothing)
'*** Fill the ImageList with Image Collection
ImageList3.Images.Add(MyThumbNail)
End Sub
The four ListView1.View = * work just fine until I execute the routine to view thumbnails. After viewing thumbnails the four ListView1.View = * routines do not work properly. Among the problems is that only jpg’s are listed in the ListView.
Any ideas or suggestions?
Thanks
Brad
|
|
|
|
|
I have a Names datatable with FirstName and Namesid columns. I'm using the following code to drive the list for the combobox.
ComboBox1.DataSource = "DataSetNames"
ComboBox1.DisplayMember = "name.firstname"
I have an Orders datatable with OrderDate and Namesid columns. When a name is choosen form the combobox list how do I write the corresponding Namesid back to the Orders table Namesid column?
Thanks in advance for any help.
|
|
|
|
|
Add this to your binding:
ComboBox1.DataSource = "DataSetNames"<br />
ComboBox1.DisplayMember = "name.firstname"<br />
ComboBox1.ValueMember = "name.Namesid"
Then when you select an item in the combox...you can return
ComboBox1.SelectedValue
which should contain the corresponding Namesid.
|
|
|
|
|
I have a textbox where a user enters his/her id number. After a click event, I want to take that id number and compare it to the id that is stored on my sql server database table, then allow the user to either proceed or stop. Any ideas how to do that?
Shannon P.
|
|
|
|
|
Use SQL to check if the value is in the table. Use the result of the SQL to decide what to do next.
More specific help would require an idea of your overall setup, and which part of this task is causing you problems.
Christian Graus - Microsoft MVP - C++
|
|
|
|
|
What I'm attempting to do is to validate what a user's id is within a textbox with what is stored within the sql server database. If the id on the textbox matches what is inside the database, begin the application. If not, display an error message to user. That is what I'm attempting to do. Any ideas would be greatly appreciated.
Shannon P.
|
|
|
|
|
Christian gave you an idea that would work. What's the problem?
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
My problem begins at "myCommand.ExecuteScalar()". My try...catch error handler reads, "Invalid object name: EmpId". My table has a column labeled "EmpId" so I'm not actually sure what the problem is. Any ideas?
Shannon P.
Dim myConnection As New System.Data.SqlClient.SqlConnection
myConnection.ConnectionString = "workstation id=SHANNON-OUYIJ2M;packet size=4096;integrated security=SSPI;data source=SHANNON-OUYIJ2M;persist security info=False;initial catalog=WorkInstructionLibrary"
'Create a parameterised command that will return the number of matches.
Dim myCommand As New SqlCommand("SELECT COUNT(*) FROM EmpID WHERE EmpID = @employeeId", myConnection)
'Set the parameter values to the credentials entered by the user.
myCommand.Parameters.Add("@employeeId", SqlDbType.Int).Value = Me.txtEmpId.Text
myConnection.Open()
Try
Dim count As Integer
count = CInt(myCommand.ExecuteScalar())
If count = 0 Then
'generic fail message
Else
'allow application to proceed
End If
Catch ex As SqlException
Dim errorMessages As String
Dim i As Integer
For i = 0 To ex.Errors.Count - 1
errorMessages += "Index #" & i.ToString() & ControlChars.NewLine _
& "Message: " & ex.Errors(i).Message & ControlChars.NewLine _
& "LineNumber: " & ex.Errors(i).LineNumber & ControlChars.NewLine _
& "Source: " & ex.Errors(i).Source & ControlChars.NewLine _
& "Procedure: " & ex.Errors(i).Procedure & ControlChars.NewLine
Next i
Dim log As System.Diagnostics.EventLog = New System.Diagnostics.EventLog
log.Source = "My Application"
log.WriteEntry(errorMessages)
Console.WriteLine("An exception occurred. Please contact your system administrator.")
MessageBox.Show("Error: EXECUTESCALAR METHOD" & errorMessages.ToString & " <> " & ex.ToString, "Error executing EXECUTESCALAR METHOD", MessageBoxButtons.OK)
End Try
|
|
|
|
|
Found the solution! My EmpId should have been my table name. Stupid syntax error on my part! Thanks to all.
Shannon P.
|
|
|
|