|
hello
i tried another alternative like
dim cmbcntrl as combobox
Dim combos() As String = New String() {"NP", "ND", "FP", "FD"}
dim i as string
For i = 0 To 11
cmbcntrl = cmbcntrl.Items.AddRange(combos)
next
there are 11 comboxes and 11 tabpage each tabpage having 1 combobox now i name these comboboxes like combobox0,combobox1,combobox3.....and also there are other comboboxes in tabpages but they are with different name..
and tried above loop
but still theres an error like:- 'expression doesnot produce a value..'
so please suggest what shall i do..
thank you....
|
|
|
|
|
hello
i tried other approach like
Dim combos() As String = New String() {"NP", "ND", "FP", "FD"}
Dim i As Integer
dim cmbcntrl as combobox
For i = 0 To 11
cmbcntrl = cmbcntrl.Items.AddRange(combos)
i am having 11 comboboxes and 11 tabpages each having one combobox now i name these comboboxes like :combobox0,combobox1,combobox3....upto '11' and also there are other comboboxes in some tabpages but they are with different name....
now i tried above loop
but it still states the syntax error like 'expression doesnot produces a value...'
so please suggest what shall i do to solve it..
thank you....
|
|
|
|
|
Dim arr() As String = {"NP","ND","FP","FD",...}
For Each tabPage In TabControl1
For Each control In TabPage
If control Is ComboBox Then
control.Items.AddRange(arr)
End If
Next
Next
Surely this works
I don't speak Idiot - please talk slowly and clearly
I don't know what all the fuss is about with America getting it's first black president. Zimbabwe's had one for years and he's sh*t. - Percy Drake , Shrewsbury
Driven to the arms of Heineken by the wife
|
|
|
|
|
hello
the code suggested had an syntax error like
'tabpage is a type and cannot be used as an expression'
so please suggest what shall i do to solve it....
|
|
|
|
|
I need to know how to do some simple things with arrays please help with any!
1.Find largest of smallest value
2.Count how many times a given value is in the array
3.Count the number of even or odd integers in the array
4.Add up the sum and compute the mean
5.Create another array of the same size containing the same values in reverse order
Thanks!
|
|
|
|
|
VB help ? Here in the VB forums ? Really ?
Sounds like homework to me. The obvious thing to do is use foreach to step over an array and calculate these things.
Christian Graus
Driven to the arms of OSX by Vista.
"I am new to programming world. I have been learning c# for about past four weeks. I am quite acquainted with the fundamentals of c#. Now I have to work on a project which converts given flat files to XML using the XML serialization method" - SK64 ( but the forums have stuff like this posted every day )
|
|
|
|
|
This is homework from your class. If we do it for you then you won't learn anything. You MUST try it yourself first. If you get stuck post the code and what you were trying to do and then someone will help you through it. Until then please make an effort.
Man who stand on hill with mouth open wait long time for roast duck to drop in
|
|
|
|
|
He's stuck at starting. I'm convinced these people don't know how to open Visual Studio or, if they get that far, start a new project.
|
|
|
|
|
Hi if anyone could help I would appreciate it. I have a database with a
Movies Table, Casting Table, and Actor Table.
Movie Table has MovieID
Casting Table has MovieID , and ActorID
Actor Table has ActorID
This code deletes a row from the movies table(using a datagrid in vb.net), I need all the rows in the Casting table with the same MovieID to also be deleted.
Any help would be appreciated!!
Dim result As String
Dim i As Integer
i = MovieDataGridView.CurrentRow.Index
result = MsgBox("Are you sure you want to delete this movie?", MsgBoxStyle.OkCancel)
If result = vbOK Then
If MovieDataGridView.Rows.Count = 1 Then
MsgBox("You must leave one movie in database!!")
Else
Me.MovieDataGridView.Rows.Remove(Me.MovieDataGridV iew.SelectedRows(0))
End If
Else
End If
Me.Validate()
Me.MovieBindingSource.EndEdit()
Me.TableAdapterManager.UpdateAll(Me.MovieProjectDa taSet)
|
|
|
|
|
I will leave answering your question to those with more knowledge than I.
However, If after waiting a few hours (remember this is the weekend) you have not received an answer, I would suggest this would be better asked in the General Database forum.
Also, it seems strange to insist that there be at least one movie in the table. Care to share the reason for this?
Henry Minute
Do not read medical books! You could die of a misprint. - Mark Twain
Girl: (staring) "Why do you need an icy cucumber?"
“I want to report a fraud. The government is lying to us all.”
|
|
|
|
|
Yeah it is strange to have to keep one movie in the table. It is because I have another problem that I will have to deal with later. This program is for a school project
See here when I add a new movie it counts the rows -1 and if there are no rows I get a no nulls allowed in movieID error. So for now I took that problem away by cheating with the msgbox!!
Dim rowcount As Integer = Form1.MovieDataGridView.Rows.Count
'Get the value of the last movie ID
x = Form1.MovieDataGridView.Item(0, rowcount - 1).Value
'Add 1 to the value of the last movie ID
x += 1
'Add new row to the datagridview's datasource
Form1.MovieDataGridView.DataSource.addnew()
'Set the value of column 1 on the new row
Form1.MovieDataGridView.Rows(rowcount).Cells(0).Value = x
'Set the value of column 2 on the new row to the data in the Title textbox
Form1.MovieDataGridView.Rows(rowcount).Cells(1).Value = txtTitle.Text
|
|
|
|
|
Hmm.. Small Reaction. As i understand, you are actually handeling your "MovieID" in code. You should let your database handle this and just request what id it gave to the last record you inserted in the database ( syntax might depend on the database you are uding)
About deleting the cast records related to the movie: you actually do the right thing I don't see any other way then to simple delete all records in that table related to the movie you have deleted.
Do Or Don't, there is no "try catch ex as exception end try"
|
|
|
|
|
I got it to work like this, I added a new query called GetDatabyDcast to my casting datatable that says
DELETE FROM Casting WHERE MovieID =@MovieID
then I added that into the delete button. This probably isnt the best way to do it but it got the job done. If you know a better way, then let me know please. Thanks
Dim result As String
Dim i As Integer
i = MovieDataGridView.CurrentRow.Index
result = MsgBox("Are you sure you want to delete this movie?", MsgBoxStyle.OkCancel)
If result = vbOK Then
If MovieDataGridView.Rows.Count = 1 Then
MsgBox("You must leave one movie in database!!")
Else
Dim s As Integer
s = Me.MovieDataGridView.CurrentRow.Index
Dim a As String = Me.MovieDataGridView.Item(0, s).Value.ToString
a = a
Dim ta As New MovieProjectDataSetTableAdapters.CastingTableAdapter
Dim tbl As MovieProjectDataSet.CastingDataTable
tbl = ta.GetDataByDcast(a)
Form3.CastingTableAdapter.Fill(Me.MovieProjectDataSet.Casting)
Form3.Validate()
Form3.CastingDataGridView.EndEdit()
Form3.TableAdapterManager.UpdateAll(Me.MovieProjectDataSet)
Me.MovieDataGridView.Rows.Remove(Me.MovieDataGridView.SelectedRows(0))
End If
|
|
|
|
|
The code to create thread at the service start event.
Dim SerialPort1 As New SerialPort
Dim returnstr As String = ""
Dim thread1 As New Thread(AddressOf RecieveSerialData)
If thread1.IsAlive = False Then
thread1.Start()
thread1.Priority = ThreadPriority.Highest
End If
If thread1.IsBackground = False Then 'I am getting an exception in this statement stating the thread is dead.
thread1.IsBackground = True
End If
Public Sub RecieveSerialData()
Try
Using SerialPort1 As IO.Ports.SerialPort= My.Computer.Ports.OpenSerialPort(b)
MessageBox.Show("The " & b & " port is now opened.")
Do
Dim incomming As String = SerialPort1.ReadLine(b)
If incomming Then
MessageBox.Show(Now.ToString)
End If
Loop
End Using
Catch ex As Exception
MessageBox.Show(ex.ToString, "Error",MessageBoxButtons.OK,
MessageBoxIcon.Error)
End Try
End Sub
The code stop the service and thread :
If thread1.IsAlive = True Then
thread1.Abort()
End If
If SerialPort1.IsOpen = True Then
SerialPort1.Close()
Else
MessageBox.Show("The service is already stoped.", "Serial Service", MessageBoxButtons.OK, MessageBoxIcon.Information)
End If
End Sub
Here I am getting various exception like
(1) The process cannot access COM3 port because it is being used by another process. This exception occurs when the first time service is activated. In the first attempt the stop service procedure executes properly.
(2) After the first execution the IsBackground statement gives an exception stating the thread id dead.
|
|
|
|
|
Normally you shouldn't set IsBackground after starting it. The thread may well run and exit before it even gets to that place (it's allowed to do that, even though it usually won't happen)
But the rest is strange, I hope someone else can help you better.
|
|
|
|
|
Hallo @ all,
my *.xml look like this
<stoerung>
<konfig>
<pfad>
</pfad>
<texte>
<txt />
</texte>
</konfig>
<pbeschr>
<prob>Server-Störung(Sprache)</prob>
</pbeschr>
<prozesse>
<prozess nr="S">
<prozessbeteiligte>
<bez>OPS1</bez>
<bez>TEC2</bez>
<bez>AVAYA</bez>
<bez>Geschäftsleitung</bez>
<bez>RITS-Leitung</bez>
<bez>VOS</bez>
<bez>Identity</bez>
<bez>Fachgruppe(n)</bez>
<bez>UHD- SchwarzesBrett</bez>
<bez>RITS</bez>
</prozessbeteiligte>
</prozess>
...
<prozess nr="xy">
<prozessbeteiligte>
<bez>OPS5</bez>
<bez>TEC1</bez>
<bez>AVAYA-1</bez>
I have more <prozess nr="x">
How can i get the complete "prozessbeteiligte" for any attribute with vb.net (Frame3.5)
Can anywhone help me?
greet
Woerny
|
|
|
|
|
Take a look at System.XML. You can open an existing XML document with the following code:
Dim doc as new XML.XMLdocument
doc.Load("Filename")
Now I'd advise you to make one main node that contains all your <Prozess nr=""> nodes, so you can iterate through that collection. That means you will have to change the layout of your XMLdocument.
When you've done that, just call a For Each loop like this:
For Each prozess as Xml.XmlNode in mainnode.Childnodes
...
Next
Looks a lot like TreeView doens't it?
Cheers,
Zaegra
Motivation is the key to software development.
|
|
|
|
|
hi to all,
I am creating n running an process using the code
dim p as new process
p.startinfo==path
p.start()
p.waitforexit()
my problem is when i make the path as a link. then it gives a error msg in p.waitforwxit() line saying "no procedss is associated with the process"....with noramal path it works fine...only when i give a link (say, c:\aa\calculator.lnk) it shows the error
please help me out
thanks in advance
-----------------------------
I am a beginner
|
|
|
|
|
hi,
the first or only parameter for Process.Start should be a string pointing to:
- either an executable file (.EXE)
- or a document for which a file association exists (e.g. a .DOC assuming MS Office has been installed)
Luc Pattyn [Forum Guidelines] [My Articles]
The quality and detail of your question reflects on the effectiveness of the help you are likely to get.
Show formatted code inside PRE tags, and give clear symptoms when describing a problem.
|
|
|
|
|
thanks for the answer...
but it works with even a shortcut...n thats my requirement too
How do i achieve that?
-----------------------------
I am a beginner
|
|
|
|
|
It seems I'm not thinking so clearly today, so you want to start the application linked to a shortcut?
Motivation is the key to software development.
|
|
|
|
|
Your code is not giving any time for the process to start. After you call Start, you have to wait for the process to start before you call WaitForExit. Try calling WaitForInputIdle before WaitForExit.
|
|
|
|
|
hello everyone
i am having 2 textboxes now i display '0' values in both textboxes at design time
at run time i change the values of it like textbox1 has value 3 now i want that textbox2 should start from 1 when i enter any numeric value in textbox 1
for this example if i enter 3 in textbox1 then textbox2 should be 1 and inrement likewise.
for that my code is:
If Val(Me.txtbox1.text) > Val(Me.txtbox2.Text) > 0 Then
Me.txtbox2.Text = Val(Me.txtbox2.Text) + 1
Else
Me.txtbox2.Text = Val(Me.txtbox2.Text) - 1
End If
but this is not working
please suggest some another code
thank you all.
|
|
|
|
|
It seems like a pretty straight-forward question, but still I don't understand what needs to be done. Please explain it again so I might understand what you're trying to do
Cheers,
Zaegra
Motivation is the key to software development.
|
|
|
|
|
suppose there are two textboxes and button1 in form
textbox1- for no of documents
textbox2-is counter
now when i type '3' in textbox1
then this count which is another textbox2 should auto generate from '1'
now when i click on button1 then this count should have value '2' and all textboxes becomes clear
i.e there should be 2 in textbox2
now when i again click on button1 then this count which is textbox2 should have value '3'and all textboxes become clear..
please suggest some code for it
hope you got me...
please help...
|
|
|
|