|
try this
reader = "SELECT Column FROM Table"
'send the reader as query and get the result in the same
combobox.Items.Clear()
While (reader.Read())
combobox.Items.Add(reader("column").ToString)
End While
If (combobox.Items.Count <> 0) Then
combobox.SelectedIndex = 0
End If
self confidence+hard work=SUCCESS
|
|
|
|
|
I have used the Microsoft.Practices.Enterpriselibrary. I also use the connection string. I want to ecrypt the userid and password. If anyone has idea , show me method how to do.
flowerppk
|
|
|
|
|
First, show us that you have attempted to do this yourself.
I'm going to become rich when I create a device that allows me to punch people in the face over the internet.
"If an Indian asked a programming question in the forest, would it still be urgent?" - John Simmons / outlaw programmer
|
|
|
|
|
Hi every one..
I have a problem to export my SQL data to excel format directly by VB.net program (on VS2008). I already try with any script but it didn't work. Anybody can help me to solved this problem ?. Thanks so much...
|
|
|
|
|
|
Hi everyone,
I am looking for a way to generate a graph in VB based on data coming from an Access database.
Can anyone guide me into the right direction? I could not find anything posted here to show me how to do it and the books I have does not mention a thing about Graphs.
Any help will be much appreciated,
Maria
|
|
|
|
|
Have you solved this?
"The clue train passed his station without stopping." - John Simmons / outlaw programmer
|
|
|
|
|
It looks like the only way I can generate a chart in VB2005 is to use Drawing2D which is a pain. Because I don't want to use any third party packages I will have to learn ho to do this. Any suggestions will be much appreciated.
Thank you,
Maria
|
|
|
|
|
Hello i'm sorry to ask
Maybe the title of the Question is not clear. But i don't know where i should begin
I should do an application that give a messge box when i open a sepecific folder and add anything on it or delete from it
The message box should tell the name of the folder or whatever i add or delete and the opeation done
Thanks in advance
Assaf
|
|
|
|
|
Hi,
FileSystemWatcher Class is what you need. I suggest you read MSDN and/or some
CodeProject articles about it.
Luc Pattyn [Forum Guidelines] [My Articles]
This month's tips:
- before you ask a question here, search CodeProject, then Google;
- the quality and detail of your question reflects on the effectiveness of the help you are likely to get;
- use PRE tags to preserve formatting when showing multi-line code snippets.
|
|
|
|
|
I am using visual studio 2005 express and I am having a couple of errors that I just cannot figure out.
The first error is with the master page. When I go into a .aspx page it shows the following error: template.master cannot be processed because the code directory has not been built. I do have the template.master file in the root directory.
The second error is with a skinID. When I go into a .aspx page I get the following error: A skinID has been specified but the page is not configured to use a page theme or style sheet theme. Inside an app_theme folder I have 2 files- basic.skin(skinID) and default.css(a stylesheet)
|
|
|
|
|
Sounds like you wanted the ASP.NET forum.
Christian Graus - Microsoft MVP - C++
"also I don't think "TranslateOneToTwoBillion OneHundredAndFortySevenMillion FourHundredAndEightyThreeThousand SixHundredAndFortySeven()" is a very good choice for a function name" - SpacixOne ( offering help to someone who really needed it ) ( spaces added for the benefit of people running at < 1280x1024 )
|
|
|
|
|
|
I have several list box controls in an application. Some I just add the items through a loop and the others I actually bind a datasource to. I am experiencing some strange behavior from the databound controls. If I click or scroll through the list the selected item will jump around so for example...
The items are...
First Item
Second Item
Third Item
I select Second Item no problem. I select the Third Item and the selected item will switch to the First Item. I try to select the Second Item again and it bounces back to the First Item then I select the Third Item no problem.
That can happen in any order so pay no attention to First, Second, Third, First or any pattern like that. Also this will occur with a click or a key press. I break pointed at the selected index changed event and if I were to select the Third item and the First Item catches the selection then that is the value that comes across at the selected index changed event.
Is this an issue with the databound control or is there some concept I am missing here?
CleaKO
"Now, a man would have opened both gates, driven through and not bothered to close either gate." - Marc Clifton (The Lounge)
|
|
|
|
|
Yes, if you databind to your control, the selection is lost. I suspect you are databinding again when the selectio nchanges.
Christian Graus - Microsoft MVP - C++
"also I don't think "TranslateOneToTwoBillion OneHundredAndFortySevenMillion FourHundredAndEightyThreeThousand SixHundredAndFortySeven()" is a very good choice for a function name" - SpacixOne ( offering help to someone who really needed it ) ( spaces added for the benefit of people running at < 1280x1024 )
|
|
|
|
|
Thanks for the suggestion, I just looked into that and it is not hitting the databind code again after the initial databind until the correct place.
One thing I just noticed as a pattern. If I have 15 items in a listbox and I try to scroll through them it goes in this type of order.
1, 2, 3, 4, 5, 1, 2, 3, 4, 5, 6, 1, 2, 3, 4, 5, 6, 7, 1, 2, 3, 4, 5, 6, 7, 8, 1, 2, 3, 4, 5, 6, 7, 8, 9, etc...
Does that ring any bells?
CleaKO
"Now, a man would have opened both gates, driven through and not bothered to close either gate." - Marc Clifton (The Lounge)
|
|
|
|
|
No, that does sound strange. It sounds like your data source is messed up ?
Christian Graus - Microsoft MVP - C++
"also I don't think "TranslateOneToTwoBillion OneHundredAndFortySevenMillion FourHundredAndEightyThreeThousand SixHundredAndFortySeven()" is a very good choice for a function name" - SpacixOne ( offering help to someone who really needed it ) ( spaces added for the benefit of people running at < 1280x1024 )
|
|
|
|
|
I think I explained that incorrectly, when I said that it goes in the order of 1, 2, 3, 4, 5, 1, 2, 3, 4, 5, 6, etc... I mean that the selected index will work that way, the highlighted item. So there will be a total of say 15 items in the box but when I scroll through the highlighted item will be the first item, second item, third item, fourth item, fifth item, back to the first item then through the sixth and back to the first again.
Here is the code I use to load the listboxes.
<br />
uxDepartments.DataSource = Nothing<br />
uxDepartments.Items.Clear()<br />
uxDepartments.SelectedIndex = -1<br />
<br />
_DepartmentTable = New DataTable<br />
<br />
_DepartmentTable = GetDepartmentNames<br />
<br />
uxDepartments.DataSource = _DepartmentTable<br />
uxDepartments.ValueMember = "DepartmentNameID"<br />
uxDepartments.DisplayMember = "DepartmentName"<br />
<br />
'Need to clear the listboxes with multi selection enabled<br />
uxDepartmentsForList.SelectedItems.Clear()<br />
<br />
If _DepartmentTable.Rows.Count = 2 Then<br />
uxDepartmentsForList.SelectedIndex = 1<br />
Else<br />
uxDepartmentsForList.SelectedIndex = -1<br />
End If<br />
CleaKO
"Now, a man would have opened both gates, driven through and not bothered to close either gate." - Marc Clifton (The Lounge)
|
|
|
|
|
CleaKO wrote: _DepartmentTable = New DataTable
This is obviously a waste of time, but it won't cause your issue.
And this is a winforms app, and this code does not run again ? What's your selected index changed look like ?
Christian Graus - Microsoft MVP - C++
"also I don't think "TranslateOneToTwoBillion OneHundredAndFortySevenMillion FourHundredAndEightyThreeThousand SixHundredAndFortySeven()" is a very good choice for a function name" - SpacixOne ( offering help to someone who really needed it ) ( spaces added for the benefit of people running at < 1280x1024 )
|
|
|
|
|
Christian Graus wrote: This is obviously a waste of time, but it won't cause your issue.
Yes I am a little off and on with the new object setting depending on how I set the object later. I believe this was written before I quit with the extra step.
<br />
If uxDepartments.SelectedIndex > 0 Then<br />
uxDepartmentEdit.Text = CType(uxDepartments.SelectedItem, DataRowView)("DepartmentName").ToString.Trim<br />
uxAddDepartmentName.Enabled = False<br />
uxUpdateDepartmentName.Enabled = True<br />
uxDeleteDepartmentName.Enabled = True<br />
<br />
Else<br />
uxDepartmentEdit.Text = ""<br />
uxAddDepartmentName.Enabled = True<br />
uxUpdateDepartmentName.Enabled = False<br />
uxDeleteDepartmentName.Enabled = False<br />
<br />
End If<br />
CleaKO
"Now, a man would have opened both gates, driven through and not bothered to close either gate." - Marc Clifton (The Lounge)
|
|
|
|
|
Hi,
I have put in a custom Context menu in the webbrowser control for VB 2005. I am using the following to find out which item was clicked on:
in the document complete event:
oDoc = wBrowser.Document 'Odoc is a System.Windows.Forms.HtmlDocument
Private Sub oDoc_MouseDown(ByVal sender As Object, ByVal e As System.Windows.Forms.HtmlElementEventArgs) Handles oDoc.MouseDown
'Here is it's an input element? if yes we want to show the normal windows options....
If e.MouseButtonsPressed = Windows.Forms.MouseButtons.Right And oElement.TagName = "INPUT" Then
wBrowser.IsWebBrowserContextMenuEnabled = True
Else
wBrowser.IsWebBrowserContextMenuEnabled = False
End If
Dim MPoint As New Point(e.MousePosition.X, e.MousePosition.Y)
oElement = wBrowser.Document.GetElementFromPoint(MPoint)
End Sub
Private Sub oDoc_MouseMove(ByVal sender As Object, _
ByVal e As System.Windows.Forms.HtmlElementEventArgs) Handles oDoc.MouseMove
' On Error Resume Next
Dim MPoint As New Point(e.MousePosition.X, e.MousePosition.Y)
'e.MousePosition.X, e.MousePosition.Y)
oElement = oDoc.GetElementFromPoint(MPoint)
end sub
Private Sub cmRightClick_Opening(ByVal sender As System.Object, ByVal e As System.ComponentModel.CancelEventArgs) Handles cmRightClick.Opening
If Not IsNothing(oElement) Then
If oElement.TagName = "IMG" Then
imageMenu.Enabled = True
Else
imageMenu.Enabled = False
End If
If oElement.TagName = "A" Then
linkMenu.Enabled = True
Else
linkMenu.Enabled = False
End If
End If
The code works fine in some cases but in others (such as a facebook profile page), if I click on the profile image, the OElement tagname is "Body" and neither of "IMG" or "A". Any Ideas? thanks
|
|
|
|
|
Hi,
I am getting the this error :Object Reference not set to an instance.
when i debug i came to know that 'qry' is not initialized.Bui have initialized it.Don't Know why 'qry' is not getting initialized.
my code is:
Dim rdoSex As String
Dim CreateDate As String
Dim qry as String
Dim i As Integer
CreateDate = Now.Date.ToString()
If rdoMale.Checked = True Then
rdoSex = "M"
ElseIf rdoFemale.Checked = True Then
rdoSex = "F"
Else
rdoSex = "NA"
End If
Try
qry = ""
qry = "insert into T_STU_MASTER values('" &CreateDate & "','" & txtStudentName.Text.Trim() & "','" & txtFatherName.Text.Trim() & "','" & txtMotherName.Text.Trim() & "','" & rdoSex & "','" & dtpDOB.Text.Trim() & "','" & cmbVillage.SelectedItem.ToString().Trim() & "')"
cmd = New SqlCommand(qry, con)
'//Error is thrown in above line that qry is null while i have initialized it
i = cmd.ExecuteNonQuery()
If i > 0 Then
MsgBox("Information Saved Successfully!!!")
End If
Catch ex As Exception
MsgBox(ex.ToString())
Finally
con.Close()
End Try
|
|
|
|
|
As far as I can see, that's not possible.
Are you absolutely certain that it's not the con variable that isn't initialised?
devsheoran wrote: Urgent Please help
It's never urgent enough to mention in the subject.
Despite everything, the person most likely to be fooling you next is yourself.
modified on Tuesday, March 11, 2008 4:39 PM
|
|
|
|
|
Are you *certain* ? Although this is pretty terrible code, I don't see any way that qry could be uninitialised. Try stepping through with the debugger and checking variable values, I think it's con that is null, it's the only thing I can not see initialisation code for.
You need to read this[^]. You also need not to initialise variables over and over ( you set qry to "", then in the next line, change it ). Also, rdoSex is not a radio button. Hungarian notation is not generally used nowadays anyhow, but that's just wrong.
Christian Graus - Microsoft MVP - C++
"also I don't think "TranslateOneToTwoBillion OneHundredAndFortySevenMillion FourHundredAndEightyThreeThousand SixHundredAndFortySeven()" is a very good choice for a function name" - SpacixOne ( offering help to someone who really needed it ) ( spaces added for the benefit of people running at < 1280x1024 )
|
|
|
|
|
can somebody help me. i made a project that compose of many forms., in the 2nd form, it has timer that has only 30 min. and it will stop if 30 minutes is over. But if the 30 minutes is not yet over and i already reach the last form which is form10, the timer in the 2nd form should stop and the 2nd form will be hide. How can i do it?
the project that i am making is an IQ test, and it has many pages, when the test is answered already, the timer should stop..
can somebody please help me about my problem.. thanks!
|
|
|
|
|