一部のフォームにコンボボックスを作成する方法が重複するプロジェクトに取り組んでいます。以下のコード スニペットでは、特定の PC にインストールされているフォントが項目としてコンボ ボックスに追加されます。入力する実際のコンボボックスであるパラメーターを渡すにはどうすればよいですか? 例: AddFonts(コンボボックス)
Private Sub AddFonts()
'add the font names installed on this pc to the font name combo box
' Get the installed fonts collection.
Dim allFonts As New InstalledFontCollection
' Get an array of the system's font familiies.
Dim fontFamilies() As FontFamily = allFonts.Families
' Display the font families.
For i As Integer = 0 To fontFamilies.Length - 1
'figure our how to make the textbox passable as a paramter
cbxTitleFonts.Items.Add(fontFamilies(i).Name)
Next
End Sub