|
You people are vb gods, like seriously ... this thing works perfectly .. does the exact thing that I wanted ... but I'm a bit not satisfied ... why? I want to know how this is really working ... I don't understand how it works ... in the conditional statements, what is really being compared?
On forward:
if currentrecord < (records.length - 1) then ...
what does the current line number (currentrecord) have to do with the length of the record (record.length)?
Sorry if i'm annoying ..
gHoSt
|
|
|
|
|
ok so what i did was create the currentrecord variable to keep track of exactly that, the record that is currently open. But how does it find each record? Well...
Dim Records() as string = file.readalllines("c\example")
This line makes a new array of strings (without affecting the contents of the original file), if your not sure what that is, best to google it, but i will explain breify. An array creates an indexed list from a given source that can be quickly an easily accessed.
For Instance, when we did the above line, the array would be visually represented like this.
Records(0) = aaa 333<br />
Records(1) = bbb 444<br />
Records(2) = ccc 555<br />
Records(3) = ddd 888<br />
Records(4) = ggg 111
Notice how the indexing starts at zero. Therefore there is the last item in the list (the fifth) has an index of four.
The Records.length gives us the total amount of items in the list. So...because each item has an index of one less than the amount it is, the last item has the index (records.length - 1) .
So. Say for instance our current record is 4 (ggg 111). When we use the line you asked about it will check if this is less than the final item, and will do the appropriate action. However because it is the final item it will do nothing, as trying to display one more than this would result in an IndexOutOfBoundsException meaning that there is no such item.
If you veiw the statement in full, you see that by the time we get to line 3, the current record integer is equal to 5, which won't work. If an item with the specified index does exist than this is what we call 'within bounds'.
1 if currentrecord < (records.length - 1) then<br />
2 currentrecord +=1<br />
3 me.displaytextbox.text = records(currentrecord)<br />
4 end if
The if statements are basically error prevention, they stop your program crashing when there is no data where you are asking for it.
|
|
|
|
|
Can I limit the options in the 'Export button' of the Report Viewer? How?
Instead of having 'Excel and PDF' in the option, I want it just 'PDF' for the user to save on PDF format only.
OR...
If the 'Export button' is clicked, it will automatically save in the PDF format only after providing the desired filename.
|
|
|
|
|
You can configure the available rendering extensions in your rsreportserver.config file. You can find this in the ReportServer folder where Reporting Services is installed. Change the Extension nodes under the Render section.
Paul Marfleet
"No, his mind is not for rent
To any God or government"
Tom Sawyer - Rush
|
|
|
|
|
Is there a way to change the highlight color of a selected item in a treeview? I've created a mouse hook so that when the mouse is over the treeview, the item the mouse is over is hightlighted, but the is highlightd in gray. I like it highlighted with the system's highlight color.
|
|
|
|
|
I have in my application a subroutine that opens a browse folder so that the user can browse to a specific directory, and load that into a text box. The code is like this:
...
Set shlShell = New shell32.Shell<br />
<br />
Set shlFolder = shlShell.BrowseForFolder(Me.hWnd, "Select a Folder", BIF_RETURNONLYFSDIR)<br />
<br />
textbox_txt.SetFocus<br />
textbox_txt.Text = shlFolder.Items.Item.Path 'places path into text box
Now, my problem is not when the user browses to a path and clicks OK, that returns the path of the directory fine. What the issue is, when the user clicks CANCEL, I get an error: runtime error '91' Object variable or With block not set. Any ideas on how I should handle this? Thanks.
reegan41
|
|
|
|
|
Assuming you are using VB.Net
You need to test the existence of shlFolder
If Not IsNothing(shlFolder) Then
process files
End If
However, you should really be using the .net directory and file info classes to achieve this with a directory browser dialog or openfile dialog!
Quote from Great Outdoors:
its a confident traveller who farts in India
|
|
|
|
|
I have been looking into Delegates and have been working through some tutorials. One snippet that has me confused is:
Delegate Sub MyHandler(Of T)(ByVal sender As T, ByVal e As MyEventArgs)
The (Of T) has me confused, can anyone explain thid please.
Thanks
|
|
|
|
|
|
Hello,
I have a dll that uses a webreference to a client's webservice. On my pc this works correctly. When i try to move the dll to our webservice and try to do a createobject to it via an asp page, I get the following error:
Failure in connecting to xxxxxxxxxxxx: System.InvalidOperationException: Unable to generate a temporary class (result=1). error CS2001: Source file 'C:\WINNT\TEMP\b6vvurwf.0.cs' could not be found error CS2008: No inputs specified at System.Xml.Serialization.Compiler.Compile(Assembly parent, String ns, XmlSerializerCompilerParameters xmlParameters, Evidence evidence) at System.Xml.Serialization.TempAssembly.GenerateAssembly(XmlMapping[] xmlMappings, Type[] types, String defaultNamespace, Evidence evidence, XmlSerializerCompilerParameters parameters, Assembly assembly, Hashtable assemblies) at System.Xml.Serialization.TempAssembly..ctor(XmlMapping[] xmlMappings, Type[] types, String defaultNamespace, String location, Evidence evidence) at System.Xml.Serialization.XmlSerializer.FromMappings(XmlMapping[] mappings, Type type) at System.Web.Services.Protocols.SoapClientType..ctor(Type type) at System.Web.Services.Protocols.SoapHttpClientProtocol..ctor() at RFxxxxxxxxxxx.com.xxxxxxxxxxx.xxxxxxxxx.xxxService..ctor() at RFxxxxxxxxxxx.Connect.HandShake(String sUserID, String sPW)
Anyone seen this error and how do you deploy a dll that has a webreference?
There are 4 files when compiled: dll, tlb, xml, config. I put all of those in the same directory on the server and registered the dll file. so I think all supporting files are there on the server...
Thanks,
Nathan
|
|
|
|
|
Hi
I need to connect to a mysql Dbase on a unix server
using ssh in VB.net can anybody help as ive tried all I know I cant seem to get it right
can I get a sample with the response
Bellow is the code ive been using to try to connect
The proble is that the code connect but it does not go pass the con.open instead it gives an error that says Connection unexpectedly terminated
Public Function Plink_Start(ByVal Host As String, ByVal Username As String, ByVal Password As String, Optional ByVal Hidden As Boolean = True, Optional ByVal LocalPort As String = "3307", Optional ByVal RemoteHost As String = "localhost", Optional ByVal RemotePort As String = "3307") As Boolean
Plink.StartInfo.FileName = Application.StartupPath & "\plink.exe"
Plink.StartInfo.Arguments = "-ssh -l " & Username & " -pw " & Password & " -L " & LocalPort & ":" & RemoteHost & ":" & RemotePort & " -batch " & Host
If Hidden = True Then
Plink.StartInfo.WindowStyle = ProcessWindowStyle.Hidden
End If
Try
Plink.Start()
Return True
Catch ex As Exception
MsgBox(ex.Message)
Return False
End Try
End Function
------------------------------------------------------------------------------------------------------------------------------------------
Public Function dbConnect() As MySqlConnection
'
Try
Plink_Start("xxx", "xxxxx", "xxxx", 1, " xxx ", "xxx", "22")
dbaseConn.ConnectionString = "server=xxxxxxx;" _
& "port=xxx;" _
& "uid=xxxx;" _
& "pwd=xxx;" _
& "database=xxx;" _
& "allow zero datetime=true"
Plink.Start()
If Plink.HasExited = False Then
dbaseConn.Open()
dbConnect = dbaseConn
Else
dbaseConn.Close()
dbConnect = dbaseConn
End If
Catch ex As MySqlException
dbaseConn.Close()
dbConnect = dbaseConn
End Try
End Function
im a junior developer at a company called securemail in south africa
|
|
|
|
|
I've been trying to find an easy-to-understand format for documenting our group policy settings. I want to document not just the policies and the OUs that link to them, but the actual settings within the policies.
Can you guys suggest me a good script or help me to make a vb.net application for the same which can give me detailed information on the forest-wide group policy configuration.
Kinpin2005
|
|
|
|
|
HI,
i'm programming in C#
when i've gone to learn VB i tried something simple
The :
/*
code....
*/
note tokens...
is there any thing simliar in VB?
Have Fun
Never forget it
|
|
|
|
|
There is no Multi Line Comment support in VB.NET as yet but hopefully in the future you have to select all the code which you want to comment and then use the Comment button in IDE.
Hope it helps !
AliAmjad(MCP)
First make it Run THEN make it Run Fast.
|
|
|
|
|
THANKS
Have Fun
Never forget it
|
|
|
|
|
Hi, IMO the best way to learn a new language is to buy a book and work your way through it.
That way you will get all the essentials in a short time, both explained and illustrated.
Luc Pattyn [Forum Guidelines] [My Articles]
this months tips:
- use PRE tags to preserve formatting when showing multi-line code snippets
- before you ask a question here, search CodeProject, then Google
|
|
|
|
|
No but there is an easy way to comment and uncomment blocks of code. Just highlight the code and press the toolbar item that does that and it will put ' infront of all the lines of code you highlighted. Same goes if you want to uncomment a block of code.
|
|
|
|
|
Hey guys could someone out there help me , i want to print some receipts from an Epson TMU printer could some one help with code for printing this or some advice.
|
|
|
|
|
hi to all
is it possible with check list box that selection mode property set to multi extended
if is possible than please tell me how can i do that and if not possible then
should i go for a custom control in that it is possible.
any help is highly appreciated
thanks
help everyone
|
|
|
|
|
eyes2007 wrote: is it possible with check list box that selection mode property set to multi extended
No it's Not ! only ListBox Control Support this Property !
AliAmjad(MCP)
First make it Run THEN make it Run Fast.
|
|
|
|
|
thanks for your fast reply.
i am thinking about to make one, should i go for it.
one more question
why should microsoft has to make two different controls like checklistbox and listbox.
why not they provide the checkbox fecility in the same control by making it a property.
i am thinking about the reason behind it but i can't find the answer if some body knows then please tell me.
again thanks
help everyone
|
|
|
|
|
eyes2007 wrote: i am thinking about to make one, should i go for it.
Entirely depends on your requirements did you search Code Project first for this and then Google because it gonna take allot of your time.
eyes2007 wrote: why should microsoft has to make two different controls like checklistbox and listbox.
Because both of these controls are for different requirements and one has advantage over the other e.g. you can't bind data to the CheckedListBox control for this you have to use either ComboBox or Listbox and also not support for Multi Selection whereas in ListBox Control you can't display a Checkbox besides every item.
Hope it helps !
AliAmjad(MCP)
First make it Run THEN make it Run Fast.
|
|
|
|
|
Hello
I'm trying to communicate with an application written in C++ that receives windows messages. The problem is that i need to pass a pointer to a structure from VB.
In C++ the code to send a message looks like this (works fine)
BOOL bRC = false;
COPYDATASTRUCT cpd;
cpd.dwData = MESSAGE_1;
cpd.cbData = 0;
cpd.lpData = 0;
bRC = ::SendMessage(m_hServer, WM_COPYDATA, (WPARAM)NULL, (LPARAM)&cpd);
I've tried using marshaling this way in VB but doesn't work:
Dim bo As Boolean
Dim data As CopyData
data.dwData = MESSAGE_1
data.cbData = IntPtr.Zero
data.lpData = IntPtr.Zero
Dim ptr As IntPtr
ptr = Marshal.AllocHGlobal(Marshal.SizeOf(data))
Marshal.StructureToPtr(data, ptr, False)
bo= SendMessage(server, WM_COPYDATA, IntPtr.Zero, ptr)
Any ideas? thank you.
|
|
|
|
|
How can I make the system sleep for a while so that in the meanwhile my files get populated with some data and after that I can access the file for processing. Is there any way in vb.net or I have to call some API functions ?
Thanks in Advance.
Sekhar
|
|
|
|
|
System.Threading.Thread.Sleep(1000) '1000 Milli Second delay
Or you can use a different thread to do the population of the files.
Private Sub PopulateFiles<br />
.....<br />
End Sub
Use the lines below in one of your Procedures, which then calls the PopulateFiles procedure on a new thread.
Dim thPopulateFiles As New System.Threading.Thread(AddressOf PopulateFiles)<br />
thPopulateFiles.Start()<br />
It can be tricky if you access the file before the new thread has finished executing - maybe look at Thread.Join as well.
|
|
|
|