|
Hi all,
I'am using VS 2003. I've a problem with combo box. I'am using 5 combo boxes with different names in my form and some text controls. All combo boxes have the same data which takes from a table. The data in combo boxes displaymember is Yes, No and valuemember is Y,N. But when i select Yes in one combo box the remaining combo boxes also getting updated with Yes. The combo box does not retaining its value with the selected one. If i select yes in one all are getting to Yes. the code is
Private Sub form_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
Try
dsPrd = New DataSet
dapPrd = New OdbcDataAdapter("SELECT * FROM yncode", conPrd)
dapPrd.Fill(dsPrd, "yncode")
sendDisValMember(cmbBtrProt, dsPrd.Tables("yncode"), "Desc", "Code")
sendDisValMember(cmbBrrRail, dsPrd.Tables("yncode"), "Desc", "Code")
sendDisValMember(cmbGrdStn, dsPrd.Tables("yncode"), "Desc", "Code")
sendDisValMember(cmbSign, dsPrd.Tables("yncode"), "Desc", "Code")
sendDisValMember(cmbFrthrIns, dsPrd.Tables("yncode"), "Desc", "Code")
Catch ex As Exception
End Try
End Sub
Public Sub sendDisValMember(ByRef cmb As ComboBox, ByVal tabName As DataTable, ByVal dismember As String, ByVal valMember As String)
cmb.Items.Clear()
cmb.DataSource = tabName
cmb.DisplayMember = dismember
cmb.ValueMember = valMember
End Sub
thanks in advance
kishore
|
|
|
|
|
If you set the data source, the combo box will reset and lose your selection. If they all have the same data source, they will all select. If you have one data source to put into more than one combo, use Clone to make copies, so they have different sources.
Christian Graus - Microsoft MVP - C++
Metal Musings - Rex and my new metal blog
|
|
|
|
|
thanks Graus,
but can you give me sample code how to clone and where to
|
|
|
|
|
When you set the data sources, I assume they are all the same object. So, each time you set it, instead of
combo.DataSource = ds
do
combo.DataSource = ds.Clone()
Christian Graus - Microsoft MVP - C++
Metal Musings - Rex and my new metal blog
|
|
|
|
|
hello everyone,
i am trying to use space out some print statements using the tab function, however have had no luck doing this. is there a new function in vb.net 2005 that replaces the tab function? thanks for your time.
console.writeline("test",tab(20), "test2")
|
|
|
|
|
I need help with merging an audio file with background music which have different sampling rates.
Thanks for your help in advance,
Kevin
|
|
|
|
|
You have to resample one of them so thst they hsve the same sampling rate.
---
b { font-weight: normal; }
|
|
|
|
|
do you know of any websites that can explain how to code this to me because I am new to audio coding
|
|
|
|
|
Hi all,
How would I go about viewing a website inside a windows form? I don't want to launch Internet Explorer because I need to control the toolbars displayed, without affecting a user's settings.
Is there a built in tool for this, or a free third party tool, or a tutorial or a technique that I can use?
Thanks for anything you give me
Jason
|
|
|
|
|
The webbrowser control does this. It *is* IE, although without the toolbars visible, so should be what you want.
Christian Graus - Microsoft MVP - C++
Metal Musings - Rex and my new metal blog
|
|
|
|
|
is this a standard control? I can't find it in my toolbox. I am using VS2003 and .NET 1.1
(thanks for the quick response! )
Jason
|
|
|
|
|
Right click on the toolbar and select 'choose items'. I'm running 2.0, but I'm sure it's always been there.
Christian Graus - Microsoft MVP - C++
Metal Musings - Rex and my new metal blog
|
|
|
|
|
ok, I found one that seems usable
There doesn't seem to be a .NET 1.1 version of a web browser, but there is a Microsoft Web Browser COM component that I can add that does what I want.
Thanks for your help Christian
Jason
|
|
|
|
|
Is there anyone in the Southern Maryland area that could teach me how to write Visual Basic.
You can contact me at vincemaier@hotmail.com or vincemaier@metrocast.net
Thanks
Vince
-- moved at 20:19 Sunday 17th September, 2006
|
|
|
|
|
Are you offering to pay someone ? Do you want to learn VB.NET or VB6 ? What do you hope to achieve ?
Really, what you should do is buy some books, work through them, ask questions here and try to join a local user group.
Christian Graus - Microsoft MVP - C++
Metal Musings - Rex and my new metal blog
|
|
|
|
|
Using SQl Server 2000 Reporting Services ??
hi
i am Using SQl Server 2000 Reporting Services with:
1)- windows 2003 server
2)- VS 2003 VB(asp.net)
3) sql 2000 server
what the VB code that i can use it to display and print report within web app
by using VB(asp.net) code ??
|
|
|
|
|
Not sure what you mean. but if our trying to call a report in the ASP.NET page, then try loading the report link itself.
|
|
|
|
|
how to get an image from folder in computer
|
|
|
|
|
What do you want to do ? Load an image ? Image.FromFile will do that.
Christian Graus - Microsoft MVP - C++
Metal Musings - Rex and my new metal blog
|
|
|
|
|
Hello,
I have to display a document into a form. I can do this for rtf and txt files, but not for other files e.g. doc.
The user wants to be able to view a small picture of the file itself on the form. So I used the richtextbox tool. This is easy to do when the document is a picture, but if the document is a excel file of a word file than I am not sure how to do this.
What l have done is have a richtextbox tool on the form and assign the document to it. This only works for rtf and txt. How would I do this for word or excel.
The document will also need to be printed. The user would like to be able to click on the picture and be able to print this. I am not sure how to do this in visual basic. Is it possible to open up crystal forms and print from there?
This is the code below:
<br />
'Get the file path of the document<br />
Private Sub ultbtnDocument_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ultbtnDocument.Click<br />
<br />
ofdGetDocument.InitialDirectory = "d:\\"<br />
ofdGetDocument.RestoreDirectory = True<br />
ofdGetDocument.Filter = "Text Files (*.txt)|*.txt|Rich Text Format (*.rft)|*.rtf)|" & " All Files (*.*)|*.*"<br />
<br />
If (ofdGetDocument.ShowDialog() = DialogResult.OK) Then<br />
Dim fileName As String<br />
fileName = ofdGetDocument.FileName<br />
If (fileName.Length <> 0) Then<br />
Try<br />
ReadFileInfo(fileName)<br />
Catch ex As Exception<br />
MessageBox.Show(String.Format("{0} is not " & "a valid image file", fileName), "Error", MessageBoxButtons.OK, MessageBoxIcon.Error)<br />
End Try<br />
End If<br />
End If<br />
End Sub<br />
<br />
'Create a file stream and load the richtextbox with the file to display to the user<br />
Private Sub ReadFileInfo(ByVal fileName As String)<br />
Try<br />
Dim fs As FileStream<br />
Dim fInfo As FileInfo<br />
Dim fText As String<br />
<br />
fs = New FileStream(fileName, FileMode.Open, FileAccess.Read)<br />
fInfo = New FileInfo(fileName)<br />
fText = fInfo.Extension.ToUpper()<br />
<br />
If (fText.Equals(".RFT")) Then<br />
rtxtDocument.LoadFile(fs, RichTextBoxStreamType.RichText)<br />
ElseIf (fText.Equals(".TXT")) Then<br />
rtxtDocument.LoadFile(fs, RichTextBoxStreamType.PlainText)<br />
End If<br />
Catch ex As Exception<br />
MessageBox.Show(ex.Message & ex.StackTrace)<br />
End Try<br />
End Sub<br />
Is there a way to convert the excel, word, or other document to a jpeg format. That would be much easier. Moreover, the user would like to click on the document once it is displayed in the form, and open a large form with the actual size of the document. Is this possible?
Many thanks in advance,
Steve
-- modified at 8:36 Sunday 17th September, 2006
|
|
|
|
|
To load an Office document, you need to control Office in your application, using .NET or COM. There's no way to render an Office doc as a jpeg that I know of.
Christian Graus - Microsoft MVP - C++
Metal Musings - Rex and my new metal blog
|
|
|
|
|
Try to load your document on a WebBrowser control WebBrowser1.Navigate("C:\New Microsoft Word.doc").
Sakis
|
|
|
|
|
Will this code populate my combobox with all item in the datatable column if place in form_load
Dim mytable As New DataTable()<br />
mytable = myset.Tables("doc_reg")<br />
cbodoctor.DataSource = mytable<br />
cbodoctor.DisplayMember = "ColumnName"<br />
cbodoctor.ValueMember = "ColumnName" <br />
myfend_liang & _mubashir thanks
Fikunmi Feyijin
Hicad Systems
Nigeria
|
|
|
|
|
You need to call the DataBind method also.
---
b { font-weight: normal; }
|
|
|
|
|
Hi
I have created an Shared Add In application for MS Office. In that
I am trying to remove an Button, which is added to standard tool bar in MS word.
I am using following code to add an button in MS Word. Which written on OnStartUpComplete event.
Dim WithEvents MyButton As CommandBarButton
Dim oCommandBars As CommandBars
Dim oStandardBar As CommandBar
On Error Resume Next
oCommandBars = applicationObject.CommandBars
If oCommandBars Is Nothing Then
oCommandBars = applicationObject.ActiveExplorer.CommandBars
End If
oStandardBar = oCommandBars.Item("Standard")
If oStandardBar Is Nothing Then
oStandardBar = oCommandBars.Item("Database")
End If
If MyButton Is Nothing Then
MyButton= oStandardBar.Controls.Add(1)
With MyButton
.Caption = "My Button"
.Style = MsoButtonStyle.msoButtonCaption
.OnAction = "!<mycomaddin.connect>"
.Visible = True
End With
End If
I have written following code to remove button
On OnBeginShutDown event
On Error Resume Next
MyButton.Delete()
MyButton= Nothing
but its not working
Anyone can help me please.
Thanks & Regards
AMOL
|
|
|
|