|
Whatever language you're comfortable with. It really doesn't matter.
|
|
|
|
|
HI I NEED HELP ABOUT COUNTING AN OCCURRENCE OF EACH LETTER IN A TEXTBOX
FOR EXAMPLE I HAVE 2 TEXTBOX
IN TEXTBOX1 I INPUT THE WORD "HELLO WORLD"
THEN WHEN I CLICK BUTTON 1 THEN IT DISPLAY IN TEXTBOX2 LIKE THIS:
1H 1E 3L 2O 1W 1R 1D 1R IT REVERSE AS H1 E1 L3 O2 W1 R1 T1
AS LONG AS IT DISPLAY...
THANKS IN ADVANCE I'M NEW IN VB.NET AND I DONT KNOW HOW TO DO THAT...
|
|
|
|
|
Maybe this link will help you [^]
And Read the Guidelines before you post your thread. The 8th Point.
Every new day is another chance to change your life.
|
|
|
|
|
Here is a quick / rough way that I would count the characters in a string
Dim s As Char() = TextBox1.Text.ToCharArray
Dim p As New Dictionary(Of Char, integer)
For Each chars As Char In s
If Not chars = " " Then
Dim i As Integer = s.Count(Function(r) r = chars)
If Not p.ContainsKey(chars) = True Then
p.Add(chars, i)
End If
End If
Next
Lobster Thermidor aux crevettes with a Mornay sauce, served in a Provençale manner with shallots and aubergines, garnished with truffle pate, brandy and a fried egg on top and Spam - Monty Python Spam Sketch
modified 30-Mar-12 19:35pm.
|
|
|
|
|
Your creating a Dictionary of String to store an Integer?
|
|
|
|
|
Oh crap! It was ment too be an integer
Lobster Thermidor aux crevettes with a Mornay sauce, served in a Provençale manner with shallots and aubergines, garnished with truffle pate, brandy and a fried egg on top and Spam - Monty Python Spam Sketch
|
|
|
|
|
Please do not scream at me. Thank you.
Why is common sense not common?
Never argue with an idiot. They will drag you down to their level where they are an expert.
Sometimes it takes a lot of work to be lazy
Please stand in front of my pistol, smile and wait for the flash - JSOP 2012
|
|
|
|
|
How do you know that, VB programmers aren't case-sensitive
"You get that on the big jobs."
|
|
|
|
|
RobCroll wrote: VB programmers
I would only tolerate it if my "option strict" was on.
Why is common sense not common?
Never argue with an idiot. They will drag you down to their level where they are an expert.
Sometimes it takes a lot of work to be lazy
Please stand in front of my pistol, smile and wait for the flash - JSOP 2012
|
|
|
|
|
Hello helper
I am student in ethiopia.
i need a code that search and add only mobile bluetooth name in listbox using vb code i am not want to send or receive data. i am using BT2.0 USB bbluetooth device with my PC. please help me a code if you can send me sample project.
thanks about
|
|
|
|
|
|
Hi,
I'm currently developing a windows form application in Visual Studio 2008 (Visual Basic). I'm pulling information from an access database to a form. I have a combobox and textboxes, I want to autofill or populate the textboxes from the users combobox selection. I've got the combobox working fine by simply setting it's DataSource and DisplayMember properties but can't seem to get the textboxes to fill with the information from the rest of the table row.
By the way, I will have 5- 10 rows on my form. A combobox with 8 textboxes. In my experimentation I got the first row working but it filled in the information in the other rows. Any help would be greatly appriciated.
Joe
|
|
|
|
|
Without seeing any of your code, it's difficult to imagine how you are trying to return the data, however I guess you are populating the combo with an ID or UserName value from the database.
To then populate your text boxes, by selecting a value in the combobox could call a function to query the database.
The sql query would return the associated fields values based on the ID or UserName value selected, which are then inserted into the various textboxes.
I can provide a working example but I think you are supposed to provide some code and "we" then provide assistance.
|
|
|
|
|
Thank You for replying,
As I said in my initial post I've gotten the combobox working by setting it's DataSource Property and DisplayMember Property. I haven't written any code other than to establish a connection to my database, construct a data adapter and data table.
|
|
|
|
|
The answer would depend on the type of datasource, are you using Datatable ? TableAdapater ? DataSet ? Custom Classes?
That is why you were asked to show some of your code.
Lobster Thermidor aux crevettes with a Mornay sauce, served in a Provençale manner with shallots and aubergines, garnished with truffle pate, brandy and a fried egg on top and Spam - Monty Python Spam Sketch
|
|
|
|
|
Thanks for replying,
This is all I've written so far:
Public Class frmFoodLabelData
Private fdftconn As New OleDb.OleDbConnection()
Private dafdft As OleDb.OleDbDataAdapter
Private cbfdft As OleDb.OleDbCommandBuilder
Private dtFdItems As New DataTable
Private m_rowPosition As Integer = 0
Private Sub frmFoodLabelData_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
'TODO: This line of code loads data into the 'FoodDataSet.FdItems' table. You can move, or remove it, as needed.
Me.FdItemsTableAdapter.Fill(Me.FoodDataSet.FdItems)
fdftconn.ConnectionString = "Provider=MicroSoft.ACE.OLEDB.12.0;Data Source=C:\FoodFight\Food.accdb"
fdftconn.Open()
dafdft = New OleDb.OleDbDataAdapter("Select * From FdItems", fdftconn)
cbfdft = New OleDb.OleDbCommandBuilder(dafdft)
dafdft.Fill(dtFdItems)
End Sub
As I said I've gotten the combobx working by setting it's DataSource and DisplayMember properties. Hopefully I can get pointed in the right direction. Any help would be appriciated.
|
|
|
|
|
I would have a read of this DataTable.Select[^]
There is an example of how to use the select method 1/3rd of the way down the table.
Lobster Thermidor aux crevettes with a Mornay sauce, served in a Provençale manner with shallots and aubergines, garnished with truffle pate, brandy and a fried egg on top and Spam - Monty Python Spam Sketch
|
|
|
|
|
Hello people,
How do you get the middle number between a chosen set of two numbers, for example, I have two numbers, 2 and 8, the number I would wanna get is 5. It would also help how you would convert a decibel number and round it into the closet whole number.
Regards,
Brandon T. H.
Simple Regards,
Brandon
|
|
|
|
|
by putting each number between 2 and 8 into a list and then using the list(of t).Average() I was able to get at the answer that you want but not sure if that is what you are after! If not then please expand your question further.
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Dim x As New List(Of Integer)
For i As Integer = 2 To 8
x.Add(i)
Next
Dim avg As Double = x.Average()
Messagebox.show(avg.toString())
End Sub
Lobster Thermidor aux crevettes with a Mornay sauce, served in a Provençale manner with shallots and aubergines, garnished with truffle pate, brandy and a fried egg on top and Spam - Monty Python Spam Sketch
|
|
|
|
|
Brandon T. H. wrote: How do you get the middle number between a chosen set of two numbers, for example, I have two numbers, 2 and 8, the number I would wanna get is 5.
Add both numbers together, divide by two.
Brandon T. H. wrote: It would also help how you would convert a decibel number and round it into the closet whole number.
Add .5 and cast to an int.
Bastard Programmer from Hell
|
|
|
|
|
Public Shared Function Average(ByVal val1 As Integer, ByVal val2 As Integer)
If (val2>val1) Then
Dim temp As Integer = val1
val1 = val2
val2 = temp
End If
While (val1>val2)
val1 = val1 - 1
val2 = val2 + 1
End While
Return val1
End Function
alternatively, (val1+val2)\2
|
|
|
|
|
nice answer.. both the alternatives provided.. 
|
|
|
|
|
In my Project I am trying to Open Folders, I listview the startup items, and you can right click and go to the item folder location. For this code, the users appdata folder works fine. the path
C:\ProgramData\Microsoft\Windows\Start Menu\Program\Startup" Doesnt open up to the right location. It just opens up the C:\user\username\ folder instead.
If anybody knows how to open this folder it would be greatly appreciated. I am using VB 2010.
For a = 0 To (ListViewLogon.SelectedItems.Count - 1)
Dim MyKey = ListViewLogon.SelectedItems.Item(a).SubItems.Item(4).Text
Dim GroupFolderStartUpItems = ("C:\ProgramData\Microsoft\Windows\Start Menu\Program\Startup")
Dim Group2FolderStartUpItems = ("C:\Users\" & Environment.UserName & "\AppData\Roaming\Microsoft\Windows\Start Menu\Programs\Startup")
If MyKey = GroupFolderStartUpItems Then
Dim sPathspec = "C:\ProgramData\Microsoft\Windows\Start Menu\Program\Startup"
WshShell.run("explorer /e" & sPathspec, 1, False)
ElseIf MyKey = "C:\Users\" & Environment.UserName & "\AppData\Roaming\Microsoft\Windows\Start Menu\Programs\Startup" Then
Shell("explorer " & Group2FolderStartUpItems, vbNormalFocus)
End If
Next
|
|
|
|
|
If you are running Windows 7 or Vista, UAC will not allow you to open the ProgramData folder.
As a result, you will not be able to access it. Running your program as administrator should allow you to read the folder.
|
|
|
|
|
The Program does run as Administrator.
<requestedExecutionLevel level="requireAdministrator" uiAccess="false" />
That should be correct? Is what My manifest settings is at. unless uiAccess should be true. but Its always been this way, and when I start the program. Prompts to run under Administrator access and then starts it. Could there be something else wrong?
|
|
|
|