|
waner michaud wrote: listbox.items is READONLY
I know, and I'm glad it is. I don't want to replace the collection by another one; I often want to operate on the collection though.
Luc Pattyn
Local announcement (Antwerp region): Lange Wapper? Neen!
|
|
|
|
|
hi expert
i want pass value in textbox when I addition of two number in javascript.
ex.
var c = parseFloat(a) - parseFloat(b);
textbox1.text=c;
This example is not work.
|
|
|
|
|
You have 'javascript' and 'asp.net' in your subject yet you decided the 'visual basic' forum was the place to post your question.
|
|
|
|
|
It's a crosspost, I just saw the answer elsewhere...
|
|
|
|
|
At the moment of my posting here it wasn't I checked.
I guess he read my reply and then went to ask in the correct forum.
|
|
|
|
|
Hi,
I need help with this following code. It's to read word stored in two text files and storing in a arry for someprocessing later. this code works fine when the text files are below 10kb .it gives error in line marked bold when it's around 19kb..can some one help me to sort it please..? the error is "Key cannot be null. Parameter name: key" on that red marked line
Imports System.IO
Imports System.Text
Public Class Form1
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Button1.Enabled = False
Dim ga As Integer = 0, ba As Integer = 0
Dim gaen As Integer = 0, baen As Integer = 0
' totalbad As Integer = 0
' reading good words dictionary file
Dim goodReader As StreamReader = File.OpenText("good.txt")
' reading bad words dictionary file
Dim badReader As StreamReader = File.OpenText("bad.txt")
' creating array with the good words
Dim gl As New ArrayList()
Dim hshgood As New Hashtable()
While Not goodReader.EndOfStream
gl.Add(goodReader.ReadLine())
If goodReader.ReadLine() IsNot Nothing Then
hshgood.Add(goodReader.ReadLine(), goodReader.ReadLine())
End If
End While
' creating array with the bad words
Dim bl As New ArrayList()
Dim hshbad As New Hashtable()
While Not badReader.EndOfStream
bl.Add(badReader.ReadLine())
If badReader.ReadLine() IsNot Nothing Then
hshbad.Add(badReader.ReadLine(), badReader.ReadLine())
End If
End While
Thanks
Surej
|
|
|
|
|
Surej70 wrote: While Not goodReader.EndOfStream
gl.Add(goodReader.ReadLine())
If goodReader.ReadLine() IsNot Nothing Then
hshgood.Add(goodReader.ReadLine(), goodReader.ReadLine())
End If
End While
How many lines would this read in one iteration of the loop?
Are you sure the number of lines in the file is a multiple of that number??
BTW: in a HashTable all keys must be non-null and different; can you guarantee they will all be different?
Luc Pattyn
Local announcement (Antwerp region): Lange Wapper? Neen!
|
|
|
|
|
Hi,
Thanks for the reply. actually i am trying to help a friend of mine and i am not really good with this. If you have time can you please have alook at it..? I have uploaded in rapidshare.
http://rapidshare.com/files/287639191/compare.rar
there are two text files "bad.txt" and "good.text" these files will work with out any problem the other ones that dont work are good2 and bad2. these got more words in.
Thanks
Surej
|
|
|
|
|
Hello Every body ,
Can anyone provide solution to this error .As this error is related to Change of PC name.But i dont know solution to get through it.So plz need Help ....
-2147467259 :[Microsoft]ODBC SQL Server Driver (The Cursor does not include the table being modified. Or the table is update able through the Cursor.)
Thanks in advance.
|
|
|
|
|
Does this happen when you try to change the name of your Pc Programatically ?
if not then you should not post non Programming problems here. Look at the Following links they might help
http://support.microsoft.com/kb/290413[^]
Vuyiswa Maseko,
Spoted in Daniweb-- Sorry to rant. I hate websites. They are just wierd. They don't behave like normal code.
C#/VB.NET/ASP.NET/SQL7/2000/2005/2008
http://www.vuyiswamaseko.com
vuyiswa@its.co.za
http://www.itsabacus.co.za/itsabacus/
|
|
|
|
|
Since you haven't show us the code that's throwing the error, this list[^] of Google search results is the best you're going to get right now.
...and that error message has nothing to do with changing the computer name of a PC.
|
|
|
|
|
Hi all,
I'm working on a vb.net application that has many functions and sub's.
In one of the sub, I check the values in a field with a list from database and with another text file.
The condition goes as follows:
If a field value in text file 1, not found in list from database, then I will check if the field value in text file 1 exist in text file 2.
If found both the fields same in both the text file, I perform an action,
If found that the first field is same and second field not same, I perform another another action,
If found that both the fields are not the same, I perform another action.
Thanks in Advance.
modified 28-Nov-12 7:56am.
|
|
|
|
|
vijay2482 wrote: If (cad.EnfantInM1 Or cad.IsStdComponent) And doc.enfant = cad.enfant And doc.draw = cad.draw Then
WriteCreateToExcelDoc(cad, doc, exlLst)
ElseIf (cad.EnfantInM1 Or cad.IsStdComponent) And doc.enfant = cad.enfant And doc.draw <> cad.draw Then
WriteCreateToExcelDoc(cad, doc, exlLst)
ElseIf (cad.EnfantInM1 Or cad.IsStdComponent) And doc.enfant <> cad.enfant And doc.draw <> cad.draw Then
WriteCreateToExcel00(cad, exlLst)
WriteCreateToExcelND(cad, exlLst)
EndIf
Your code is obviously convoluted and messy.
If doc.enfant is not equal to cad.enfant, and doc.draw DOES equal cad.draw, nothing will happen. So, have you stepped through the code to see what's going wrong ?
Christian Graus
Driven to the arms of OSX by Vista.
Read my blog to find out how I've worked around bugs in Microsoft tools and frameworks.
|
|
|
|
|
|
Well, it's obviously impossible to work that out, based on the code you have provided.
If you simplified the code, it would be easier to read. As it stands, you need to check each line carefully, instead of checking blocks that break up the logic.
Christian Graus
Driven to the arms of OSX by Vista.
Read my blog to find out how I've worked around bugs in Microsoft tools and frameworks.
|
|
|
|
|
Hi,
IMO your complex IF stuff is equivalent to:
If cad.EnfantInM1 Or cad.IsStdComponent Then
If doc.enfant = cad.enfant Then
WriteCreateToExcelDoc(cad, doc, exlLst)
ElseIf doc.draw <> cad.draw Then
WriteCreateToExcel00(cad, exlLst)
WriteCreateToExcelND(cad, exlLst)
EndIf
Endif
which may or may not be what you want.
Luc Pattyn
Local announcement (Antwerp region): Lange Wapper? Neen!
|
|
|
|
|
Hi everyone,
I would like to use the DataGridView Checkbox like a normal checkbox.
When someone clicks on it I want to get a checked or changed event and be able to test if the box was checked or unchecked. I have written the following code:
Private Sub DataGridView1_CurrentCellDirtyStateChanged(ByVal sender As Object, ByVal e As System.EventArgs) Handles DataGridsearch.CurrentCellDirtyStateChanged
Dim checkboxcell As DataGridViewCheckBoxCell
Try
If (DataGridsearch.IsCurrentCellDirty) Then
DataGridsearch.CommitEdit(DataGridViewDataErrorContexts.Commit)
End If
If (checkboxcell.Value) Then
MsgBox("Display a message")
End If
Catch ex As Exception
End Try
End Sub
I think I am doing something wrong, Can someone suggest me a piece of code for this?
Thnaks.
|
|
|
|
|
1: please use the 'code block' tags for posting code
2:
jeshra279 wrote: If (checkboxcell.Value) Then
MsgBox("Display a message")
End If
Let me guess here your getting a nullreferenceexeption? (object not set to intance of an object (or something like that))
You declared the checkboxcell but never assigned it to the actual cell.
Further more to make this work you will have to implement some sort of test to check if the current cell is actually a checkboxcell otherwise you'll get some weird behavior if not errors.
3: for further post please post the error that your getting.
jeshra279 wrote: I think I am doing something wrong, Can someone suggest me a piece of code for this?
isn't exactly much to go on.
|
|
|
|
|
The CurrentCellDirtyStateChanged event handler manually raises the CellValueChanged event by calling the CommitEdit method.
Sub DataGridsearch_CurrentCellDirtyStateChanged( _
ByVal sender As Object, ByVal e As EventArgs) _
Handles DataGridsearch.CurrentCellDirtyStateChanged
If DataGridsearch.IsCurrentCellDirty Then
DataGridsearch.CommitEdit(DataGridViewDataErrorContexts.Commit)
End If
End Sub
So your code goes in the CellValueChanged event:
Public Sub DataGridsearch_CellValueChanged(ByVal sender As Object, _
ByVal e As DataGridViewCellEventArgs) _
Handles DataGridsearch.CellValueChanged
MsgBox("Display a message")
End Sub
|
|
|
|
|
I have found a good article at http://www.codeguru.com/columns/vb/article.php/c8459__2/ to build a ftp client. But I wanted to get everyone's input on what the best way of doing this in vb.net 2008.
What I am wanting to do is have 2 simple classes:
Class 1: Upload...
Class 2: Download...
All I want to pass into the class is the following:
IP Address
Port
Login
Password
Sending/Recieving File Location.
However I need the 2 classes to generate a form to show the user the stages of connection and progression of transmission.
Anyone have any insights on how I can go about this. Perhaps websites that can give me a working model to build from.
I could simply pass the command thru the command prompt but I would rather it be part of the main application and or .net framework if it is a must.
|
|
|
|
|
2 things:
JollyMansArt wrote: vb.net 2008
it's .net 2 or 3 or 3.5 or...
and Visual studio 2008
(just a small remark )
JollyMansArt wrote: Anyone have any insights on how I can go about this. Perhaps websites that can give me a working model to build from.
Depending on what you want there is a very easy way to do this:
my.Computer.network.uploadfile
my.computer.network.downloadfile
These 2 will work most of the time, besides that search the codeproject here to find more examples. There are tons of them.
|
|
|
|
|
JollyMansArt wrote: What I am wanting to do is have 2 simple classes:
Class 1: Upload...
Class 2: Download...
And I want my current project to be written in 5 lines of code. It's just not going to happen. The project requirements dictates the number of classes your should use, not your wishes.
JollyMansArt wrote: However I need the 2 classes to generate a form to show the user the stages of connection and progression of transmission.
These classes should not show forms at all. Their purpose should be limited to just what their title suggests, uploading and downloading a file. Any information that they need to report should be done through delegates, events and properties.
Why? You're developing this app with Windows Forms in mind. But, say you wanted to use those classes to write a Mobile app. The forms are completely different, so your classes would not be usable in a Mobile app.
|
|
|
|
|
Hello,
in my project I'm using a MDI window which holds a StatusStrip, containing Label and ProgressBar. When updating it from the BackgroundWorker of another form I get an InvalidOperationException saying (translated from German) that, before an OLE call could be processed, I'd have to set STAThread mode for the current thread.
After experimenting a lot, I'm a bit desperate... not knowing where to set STAThread mode. Does probably someone have an idea what's wrong in the following?
Here's my code:
' Call the delegate from the subform:
Private Sub BGWFileRead_DoWork(ByVal sender As Object, ByVal e As System.ComponentModel.DoWorkEventArgs) Handles BGWFileRead.DoWork
CollectFrames(BGWFileRead, AddressOf MDIMain.ShowProgress) <------ here's where the exception is thrown
End Sub
Private Sub CollectFrames(ByVal bgw As BackgroundWorker, ByVal Handler As ShowProgressDelegate)
.. (other stuff) ..
If Handler IsNot Nothing Then
Dim ProcessMessage As String = New String(String.Format("Loading file {0} ({1} of {2})", thisFrame.FileToRead.Name, SoFar, Frames.Size))
Handler.Invoke(CLng(Frames.Size), SoFar, thisFrame.FileToRead.Name, ProcessMessage, ExecutionTime)
End If
End Sub
' Main MDI form:
Public Delegate Sub ShowProgressDelegate(ByVal Files As Long, ByVal TotalFiles As Long, ByVal filename As String, ByVal Message As String, ByVal Time As Integer)
Public Sub ShowProgress(ByVal Total As Long, ByVal SoFar As Long, ByVal file As String, ByVal Message As String, ByVal Timespan As Integer)
If Me.InvokeRequired Then
Dim SPdeleg As New ShowProgressDelegate(AddressOf ShowProgress)
Me.BeginInvoke(SPdeleg, New Object() {Total, SoFar, file, Message, Timespan})
Else
' actualize StatusStrip
Dim percent As Integer = CInt((SoFar / Total) * 100)
Me.StatusProgressBar.Value = percent
Me.StatusLabel.Text = Message
End If
End Sub
Thanks in advance for your input!
Michael
|
|
|
|
|
Hi,
you can set the appartment state for a thread using Thread.ApartmentState; you can do this only once per thread. You may not be able to do it for ThreadPool threads (and hence BackgroundWorkers), if so you will probably need an explicit Thread.
Luc Pattyn
Local announcement (Antwerp region): Lange Wapper? Neen!
|
|
|
|
|
Thanks for your answer, Luc.
I've used the same pattern in another project successfully, in which the 'ShowProgress' method is located in the same form (i.e. there's no MDI parent form holding the ProgressBar). The only difference now is that the BackgroundWorker is started in a subform, trying to call the same method which is located in the MDI parents class. Do you think that's what kills my approach? I wonder if there's just an error somewhere in my code - or some rule like 'you can place this and that only in a module' which I haven't stumbled upon yet...
|
|
|
|