|
What do you want to do with it once it's open? This is an important point, because if you want to open and use it (as the data source for your project) the answer will be different to if you want to open it, get the information out and migrate it elsewhere...
-------------------------------------------
Don't walk in front of me, I may not follow;
Don't walk behind me, I may not lead;
Just bugger off and leave me alone!!
|
|
|
|
|
I have a Listview that is populated with information from a database using a datareader. What I'm looking to do is allow the user to select a particular row in the list and output one of the subitems to a simple text file. I'm not sure how to pull or format the subitem though and what properties to use. Any help would be appreciated!! Here is the code I used to populate the listview.
Do While hl7reader.Read
tmp1 = hl7reader("FROM_WHOM")
tmp2 = hl7reader("FROM_TERM")
tmp3 = hl7reader("CRE_TIMESTAMP")
tmp4 = hl7reader("PATIENT_NO")
tmp5 = hl7reader("APPC_DATA")
Dim str(5) As String
Dim itm As ListViewItem
str(0) = tmp1
str(1) = tmp2
str(2) = tmp3
str(3) = tmp4
str(4) = tmp5
itm = New ListViewItem(str)
ListView1.Items.Add(itm)
Loop
|
|
|
|
|
Alright I've got one of the selections outputting correctly. If I select one item, it writes correctly. Now what I'm looking to do is output multiple selections (say 6 items selected). Here's what I have.
Private Sub Button1_Click_1(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Dim ListViewSelect As ListView.SelectedListViewItemCollection = Me.ListView1.SelectedItems
Dim item As ListViewItem
Dim selecteditem As String
'Dim price As Double = 0.0
For Each item In ListViewSelect
selecteditem = item.SubItems(4).Text
Dim writer As StreamWriter = _
New StreamWriter("c:\Test.txt")
Dim line As Stream
writer.WriteLine(selecteditem)
writer.Close()
Next
End Sub
|
|
|
|
|
Hi, I need some help with my structure, I always get this error:
Exception System.NullReferenceException was thrown in debuggee:
Object reference not set to an instance of an object.
And this is the structure and how I'm using it.
Public Class Form1<br />
......<br />
Public Structure ECU_St<br />
Public ID_HS As Integer<br />
Public CB As String<br />
Public C0 As String<br />
Public C1 As String<br />
Public C2 As String<br />
Public C3 As String<br />
Public C4 As String<br />
Public C5 As String<br />
Public C6 As String<br />
Public C7 As String<br />
Public C8 As String<br />
Public C9 As String<br />
Public CA As String<br />
Public PN41 As String<br />
End Structure<br />
.........<br />
Sub ToolStripButton7Click(ByVal sender As Object, ByVal e As EventArgs)<br />
Dim PN As String<br />
Dim HSECU() As ECU_St<br />
Dim i As Integer<br />
................<br />
i = 0<br />
HSECU(i).CB = PN<br />
i = i + 1
I don't know what else to try, always I get the same error, anyone can help me? Thank you!!!
|
|
|
|
|
BThunder wrote: Dim HSECU() As ECU_St
You created an array of empty pointers to ECU_St objects. You never created an instance of these objects though. Also, you didn't provide a size for the array, so you have to increase the number of elements in the array using ReDim Preserve. But, if you're going to go through that hassle, just use a List(Of T) collection instead (only works in VB.NET 2005 and above!):
Dim HSECU As New List(Of ECU_St)
Dim i As Integer = 0
HSECU.Add(New ECU_St)
HSECU(i).CB = PN
i = i + 1
|
|
|
|
|
Thx for your really quick response!!!!
Let me try this
|
|
|
|
|
I already try this, but, when I compile, I get an error:
Expression is a value and therefore cannot be the target of an assignment. (BC30068)
HSECU.Add(New ECU_St)<br />
---> HSECU(i).CB = PN <br />
<br />
HSECU(i).CB = PN assigment???
Any Ideas?
PD. CB and PN are Strings, CB Declared with public
|
|
|
|
|
Assuming code isn't correct...
Dim newNode As ECU_St
newNode.CB = PN
HSECU.Add(newNode)
|
|
|
|
|
Ok my boss switch the concept so my previous problem is no longer valid (so I deleted it)
but now I have another problem
situation:
I have an mdi form with a menu
when the user clicks a button on the menu a function on the activeform needs to run
here's the code I have so far:
For Each f As Form In Me.MdiChildren<br />
If f.Equals(Form.ActiveForm) Then<br />
f.Add()'gives error<br />
End If<br />
Next
add() = de function that needs to run
but understandably I get an error on that
anyone know how I coud do this?
-- modified at 10:32 Tuesday 17th July, 2007
apperently the code to get the activeform doesn't work so that's another problem
does anyone know the code to get the active mdiform
|
|
|
|
|
TDDragon wrote: Ok my boss switch the concept so my previous problem is no longer valid (so I deleted it)
Thanks! I typed up this nice long explanation about why this won't work and I couldn't get it posted because you deleted your original post. Please don't do that again.
|
|
|
|
|
I appolagish for that
I woudn't do it again (just figured if it wasn't relevant anymore no need to clutter up the forum)
|
|
|
|
|
We like to leave some stuff behind so that, in the future, people searching (yeah, right. Like this ever happens!) for why an inherited form isn't working can find some information on it.
|
|
|
|
|
ActiveForm returns a Form object, not a whateverMyFormName object. So, the Form class doesn't have a method called Add . You have to cast the Form object returned by ActiveForm to the class that it really is. BTW, you don't need to iterate through the MdiChild forms. You ALREADY have the instance of the form that is active!
Dim myForm As YourFormClass = DirectCast(Form.ActiveForm, YourFormClass)
myForm.Add()
|
|
|
|
|
The problem is I don't know what the formclass is
I have for instance 20 open forms and on the active one I need to run the function add()
so I can't cast an object because I don't know wich form it is
any idee's or am I understanding your code wrong
|
|
|
|
|
Then you can create a seperate Interface that each of your child form types Implements. You then cast the ActiveForm to the Interface and call the Add method through that.
Public Interface ISomething
Sub Add()
End Interface
And in your form classes:
Public Class MyChildForm
Implements ISomething
Public Sub Add() Implements ISomething.Add
...
End Sub
...and in your ActiveForm code:
Dim myChildForm As ISomething = DirectCast(Form.ActiveForm, ISomething)
myChildForm.Add()
|
|
|
|
|
I like the interface part since I was planning on using that anyway
but the code doesn't work because 'Form.activeform' is always nothing (and I have a form active)
so I get an error that he cant cast my mdi form (wich doesn't implement the interface) to an interface
|
|
|
|
|
solved the problem
have to use me.activemdichild instead then it works perfectly
thank you for help
|
|
|
|
|
Hey Guys,
this is my first time posting a message here so please forgive me if i am doing some mistake
Major Part :- I am developing a small window application which involves getting a wave file from hard drive and then cutting it into parts and then merging each part with two other wave files
Minor Part :- The wave files are the statements that some people record so it is usual that they would have a pause at the end. so the processing of my application also involves cutting the pause or the part that does not have any sound except some noise
I would greatly appreciate if anyone can even point a method or interface which i can use to do what i require....!
Note :- I have tried using DirectShow but no good results
Amit Patel
apatel@brandinstitute.com
|
|
|
|
|
Hello there
I have build a window service it works fine until i get some task to do. If the task is say a recursive Function it starts using complete resources of the System i-e 100 % CPU Usage . I want my application not to use more then 10 % of CPU at any time.
Any Help ???
|
|
|
|
|
Hi,
AFAIK allocating CPU cycles is not supported, so getting an effective percentage of CPU
power is almost impossible; at best your app could observe its own CPU usage
and include some Thread.Sleep() to compensate when it is too high.
I would suggest though you change your app's priorities.
The simplest approach is, set your app's thread to a priority "below normal" (if
multiple threads, do it for all of them). The advantage is it comes below the normal,
interactive applications (certainly the one that has focus), and it still could
get 100% of CPU power if there is nothing else to do.
A more complex approach, which I do not recommend, is to have a timer, that changes
the app's priority (again one or all threads) between their normal value and a reduced
value, hoping to better match the 10% goal. But that is a lot of hassle (and overhead)
for still an unclear result. And I discourage all attempts to raise priorities
for such purposes, if you suddenly feel your app is not getting enough CPU cycles...
Hope this helps.
|
|
|
|
|
I want to arranges three entered words in alphabetical order.How can i do that? (Using VB.NET)
|
|
|
|
|
put the three words in an list or array and then use the sort methode
Dim l As New List(Of String)<br />
l.Add("atest")<br />
l.Add("ctest")<br />
l.Add("btest")<br />
For Each s As String In l 'just for display perposes<br />
ListBox2.Items.Add(s)'just for display perposes<br />
Next'just for display perposes<br />
l.Sort()<br />
For Each s As String In l'just for display perposes<br />
ListBox3.Items.Add(s)'just for display perposes<br />
Next'just for display perposes<br />
<br />
Dim arr As New ArrayList<br />
arr.Sort()<br />
Dim arrr As Array<br />
arr.Sort()
|
|
|
|
|
hi
is there any way to create a crystal report dynamically with design layout?? or
can i repeat the detail section dynamcially???
Thanx
Jayesh Talsaniya
|
|
|
|
|
If you are looking to dynamically show different detail sections depending on the data returned, the way to do that is to create multiple detail sections, and set the "Suppress" criteria for each section so that under the appropriate condition one detail section is shown and the others are hidden, eg:
Detail 1 Suppress Criteria
TypeID <> 1
Detail 2 Suppress Criteria
TypeID <> 2
Detail 3 Suppress Criteria
TypeID <> 3
Will hide Detail 1 when it's TypeID is not 1, etc.
Will this help in your situation?
D.
-------------------------------------------
Don't walk in front of me, I may not follow;
Don't walk behind me, I may not lead;
Just bugger off and leave me alone!!
|
|
|
|
|
Hi,
I have been trying to make a control derived from System.Windows.Forms.Panel which would allow the use of the opacity property as in the form. I am new to VB.Net, so could anyone please help me as to how this would be possible?
Thanks,
Ahmad
|
|
|
|