|
umm it should be pretty straight forward ....
just remember in C#
dim MyString as String = ""
=
string MyString = ""; <-- Dont Forget The ';'
if (...) then
...
else
...
end if
=
if (...){
...
}else{
...}
and so on ... any .NET programmer worth his salt should be able to do this.
If at first you don't succeed ... post it on The Code Project and Pray.
|
|
|
|
|
OK, this are bad news for me...
Does someone know a similar project in VB?
Last but not least: thankyou for your help.
|
|
|
|
|
Get .NET Reflector here: http://www.red-gate.com/products/reflector/[^]
Get file disassembler plugin for Reflector here: http://www.denisbauer.com/NETTools/FileDisassembler.aspx[^]
Then just disassemble compiled project into VB.
You'll get messy list of files but it will compile and will work, and you'll probably get what you need.
However - my main comment is - don't stuck on one language! Learn VB.NET and C#.
P.S. If you're asking someone to do your job every time - this means that you'll never get your own brains working.
------------------------------------------------------------
Want to be happy - do what you like!
|
|
|
|
|
Hello Every One
I am having one listview in that i am adding one column like
me.listview1.column.add("Rupees,50,Horizontal.centre")
now i fetch records from database in it
for filling listview and it worked
but the problem is i want to add the Rupees of listview and display it in one label
For that my code is like:
dim i as string
dim n as integer
dim t as integer =me.listview1.count
for i = to t-1
n=i+me.listview1.selecteditem(0).subitem(1).text
me.label1.text=n
but this seems to be wrong code can u please suggest
some another...
i am beginner
Please help...
|
|
|
|
|
1) you have ' dim i as string ' but are using 'i' in the for next loop. change to 'as integer'
2) is your intention to add up all the selected items? if so, you aren't doing that. you are adding the same value of the first selected item for as many rows that there are total.
3) The for next loop is declared as 'to listview1.count - 1' inorder to add up all the selecteditems, you need to change that to 'to listview1.selecteditems.count - 1'.
4) where's the word 'next' at the end of the loop
Dim Tot as integer = 0
For i as integer = 0 to listview1.selecteditems.count -1
Tot += cint(me.listview1.selecteditems(i).subitem(1).text)
Next
me.label1.text = Tot
Hope this helps...
Nathan
'Never argue with an idiot; they'll drag you down to their level and beat you with experience.' ~ anonymous
'Life's real failure is when you do not realize how close you were to success when you gave up.' ~ anonymous
|
|
|
|
|
hello
Dim Tot as integer = 0
For i as integer = 0 to listview1.selecteditems.count -1
Tot += cint(me.listview1.selecteditems(i).subitem(1).text)
Next
me.label1.text = Tot
The code u suggested just gives me the one by one value of items present in listview
eg :i placed this code on listview double click event so it just give me value 1 when i double click on selected row and then 2 and goes on.
but i want the total of the items present in row and display it in label
for eg:suppose there are two listviews both are having columns as Rupees but the first one is having Rs in it like(100,200,300 etc..)
what i want is when i double click on any of row of first listview it adds the items preset in the selected row one by one and displays it in label
like (100+200+300) which gives result as 600 in label
simply saying i want total of text present in the listview
so please suggest if some have any idea.
Thank You.
|
|
|
|
|
I am trying to import csv files that have comma embedded within quotes. After trying to figure the regex pattern I ended up nowhere. Using Jet drivers is the last option I could go for. Could anyone provide some help on how to do this kind of importing.
Thanks in Advance.
|
|
|
|
|
This might help - it's taken from Mastering Regular Expressions (2nd ed.) by Jeff Friedl (O'Reilly, 2002).
You need to use the RegexOptions.IgnorePatterWhitespace or edit it to leave only the RE bits.
dim regStr a s String = _
"\G(?:^|,) " & _
"(?: " & _
" (?# Either a double-quoted field... ) " & _
" "" (?# field's opening quote ) " & _
" (?<QuotedField> (?> [^""]+ | """" )* ) " & _
" "" (?# field's closing quote ) " & _
" (?# ...or... ) " & _
" | " & _
" (?# ...some non-quote/non-comma text... ) " & _
" (?<UnquotedField> [^"",]* ) " & _
" )"
Oh and check for matching parentheses - I think I've got them right but...
Regards
David R
---------------------------------------------------------------
"Every program eventually becomes rococo, and then rubble." - Alan Perlis
|
|
|
|
|
i am facing this problem , if any body can help..
Input string was not in a correct format.
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.
Exception Details: System.FormatException: Input string was not in a correct format.
Source Error:
An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.
Stack Trace:
[FormatException: Input string was not in a correct format.]
Microsoft.VisualBasic.CompilerServices.Conversions.ParseDouble(String Value, NumberFormatInfo NumberFormat) +211
Microsoft.VisualBasic.CompilerServices.Conversions.ToDouble(String Value, NumberFormatInfo NumberFormat) +74
[InvalidCastException: Conversion from string "" to type 'Double' is not valid.]
Microsoft.VisualBasic.CompilerServices.Conversions.ToDouble(String Value, NumberFormatInfo NumberFormat) +218
Microsoft.VisualBasic.CompilerServices.Operators.CompareObject2(Object Left, Object Right, Boolean TextCompare) +2984
Microsoft.VisualBasic.CompilerServices.Operators.ConditionalCompareObjectEqual(Object Left, Object Right, Boolean TextCompare) +25
Rostering.Page_Load(Object sender, EventArgs e) +1716
System.Web.UI.Control.OnLoad(EventArgs e) +99
System.Web.UI.Control.LoadRecursive() +47
System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +1436
--------------------------------------------------------------------------------
Version Information: Microsoft .NET Framework Version:2.0.50727.1433; ASP.NET Version:2.0.50727.1433
Regards
Suresh
|
|
|
|
|
Hi,
without any more information about your app and the inputs you provide, here goes my wild guess of the day:
the most popular way of getting such exception is by parsing the content of an empty textbox; left empty those bastards tend to be just unparsable.
the second most popular cause would probably be a mismatch between your regional settings, the user provided data and your code.
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.
|
|
|
|
|
Hi,
I’m following a tutorial using serialization/saving records.
I can make records, display them ok in a datgridview and then save them ok using serialization. Then I can reopen the programme and reload the dataset from the deserialised file, and show the records ok in the datagrid view - but I cannot add any more records to the datagridview.
I’d be grateful for any help/advice/assistance.
Regards,
Steve
Here is my code:
Imports System.IO
Imports System.Runtime.Serialization
Imports System.Runtime.Serialization.Formatters.Binary
Public Class Frm_DataEntry
Dim ThePoint As New Point(540, 150)
Public TheRecord As DataRow
Dim ii As Integer
Private Sub Frm_DataEntry_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
Me.Location = ThePoint
End Sub
Private Sub Tbx01_FirstName_Enter(ByVal sender As Object, ByVal e As System.EventArgs) Handles Tbx01_FirstName.Enter
Tbx01_FirstName.Clear()
Tbx02_LastName.Clear()
Tbx03_Phone.Clear()
End Sub
Private Sub Btn01_Save_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles Btn01_Save.Click
TheRecord = Frm_Mainform.dt_Table.NewRow
TheRecord(Frm_Mainform.dt_Col02_FirstName) = Tbx01_FirstName.Text
TheRecord(Frm_Mainform.dt_Col03_LastName) = Tbx02_LastName.Text
Frm_Mainform.dt_Table.Rows.Add(TheRecord)
Frm01_WithDGV.DGV01.DataSource = Frm_Mainform.ds_Dataset
Frm01_WithDGV.DGV01.DataMember = Frm_Mainform.dt_Table.ToString
Frm01_WithDGV.DGV01_BS_Col01_PKey.DataPropertyName = Frm_Mainform.dt_Col01_PKey.ToString
Frm01_WithDGV.DGV01_BS_Col02_FirstName.DataPropertyName = Frm_Mainform.dt_Col02_FirstName.ToString
Frm01_WithDGV.DGV01_BS_Col03_LastName.DataPropertyName = Frm_Mainform.dt_Col03_LastName.ToString
Dim ii As Integer
ii = Frm_Mainform.dt_Table.Rows.Count
MessageBox.Show(ii)
End Sub
Private Sub Btn02_SaveAndClose_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles Btn02_SaveAndClose.Click
Dim Filename As String = "PermitToWork.pmt"
Dim fStream As FileStream
Frm01_WithDGV.DGV01.DataSource = Frm_Mainform.ds_Dataset
Frm01_WithDGV.DGV01.DataMember = Frm_Mainform.dt_Table.ToString
Frm01_WithDGV.DGV01_BS_Col01_PKey.Width = 90
Frm01_WithDGV.DGV01_BS_Col02_FirstName.Width = 125
Frm01_WithDGV.DGV01_BS_Col03_LastName.Width = 125
Frm01_WithDGV.DGV01_BS_Col04_Date.Width = 125
Frm01_WithDGV.DGV01_BS_Col01_PKey.DataPropertyName = Frm_Mainform.dt_Col01_PKey.ToString
Frm01_WithDGV.DGV01_BS_Col02_FirstName.DataPropertyName = Frm_Mainform.dt_Col02_FirstName.ToString
Frm01_WithDGV.DGV01_BS_Col03_LastName.DataPropertyName = Frm_Mainform.dt_Col03_LastName.ToString
If File.Exists(Filename) Then
Try
fStream = New FileStream(Filename, FileMode.Create)
Dim binFormat As New BinaryFormatter
binFormat.Serialize(fStream, Frm_Mainform.ds_Dataset)
Catch anex As ArgumentNullException
MsgBox("The inventory could not be accessed")
Catch ex As SerializationException
MsgBox("The application failed to retrieve the inventory")
Finally
fStream.Close()
End Try
Else
Return
End If
Frm_Mainform.Close()
End Sub
Private Sub Btn03_Reload_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles Btn03_Reload.Click
Dim Filename As String = "PermitToWork.pmt"
Dim fStream As FileStream
If File.Exists(Filename) Then
Try
fStream = New FileStream(Filename, FileMode.OpenOrCreate, FileAccess.ReadWrite)
Dim binFormat As New BinaryFormatter
Frm_Mainform.ds_Dataset = binFormat.Deserialize(fStream)
Frm01_WithDGV.DGV01.DataSource = Frm_Mainform.ds_Dataset
Frm01_WithDGV.DGV01.DataMember = Frm_Mainform.dt_Table.ToString
Frm01_WithDGV.DGV01_BS_Col01_PKey.Width = 90
Frm01_WithDGV.DGV01_BS_Col02_FirstName.Width = 125
Frm01_WithDGV.DGV01_BS_Col03_LastName.Width = 125
Frm01_WithDGV.DGV01_BS_Col04_Date.Width = 125
Frm01_WithDGV.DGV01_BS_Col01_PKey.DataPropertyName = Frm_Mainform.dt_Col01_PKey.ToString
Frm01_WithDGV.DGV01_BS_Col02_FirstName.DataPropertyName = Frm_Mainform.dt_Col02_FirstName.ToString
Frm01_WithDGV.DGV01_BS_Col03_LastName.DataPropertyName = Frm_Mainform.dt_Col03_LastName.ToString
Catch anex As ArgumentNullException
MsgBox("The inventory could not be accessed")
Catch ex As SerializationException
MsgBox("The application failed to retrieve the inventory")
Finally
fStream.Close()
End Try
Else
Return
End If
Dim ii As Integer
ii = Frm01_WithDGV.DGV01.Rows.Count
MessageBox.Show(ii)
End Sub
End Class
Thanks for your help and advice!
Steve
|
|
|
|
|
Hello to All.
I'm getting this error
Error 1 Comma, ')', or a valid expression continuation expected.
From this line of code at the Object().
Dim schemaTable As DataTable =_dbConnection.GetOleDbSchemaTable(OleDbSchemaGuid.Tables,_New Object(){Nothing, Nothing, Nothing, "TABLE"})
I'm new to this and in need of help. If you need to see all of the code I can upload it.
Thank you.
AW
|
|
|
|
|
A Wyatt wrote: ,_New Object(){Nothing, Nothing, Nothing, "TABLE"}
This looks like a mess, what do you expect it to do ? If this is valid code in any way, it's an idiom I don't know about, but for sure if you create a new objecgt, the { } syntax is invalid, and probably generally invalid for VB
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.
|
|
|
|
|
Christian Graus wrote: This looks like a mess
Gave you a 5 just for that.
"The clue train passed his station without stopping." - John Simmons / outlaw programmer
"Real programmers just throw a bunch of 1s and 0s at the computer to see what sticks" - Pete O'Hanlon
"Not only do you continue to babble nonsense, you can't even correctly remember the nonsense you babbled just minutes ago." - Rob Graham
|
|
|
|
|
Remove the underscore before New and add a space after Object() . I'm also assuming you acutally have a variable that starts with an underscore, _dbConnection .
Dim schemaTable As DataTable =_dbConnection.GetOleDbSchemaTable(OleDbSchemaGuid.Tables, New Object() {Nothing, Nothing, Nothing, "TABLE"})
|
|
|
|
|
So VB does use curly brackets after all? Then the only thing still missing is some semi-colons...
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.
|
|
|
|
|
Don't get your hopes up. AFAIK, they're only used in array initializers.
|
|
|
|
|
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 Dave
I fixed it this way.
Dim schemaTable As DataTable = _
dbConnection.GetOleDbSchemaTable(OleDbSchemaGuid.Tables, _
New Object() {Nothing, Nothing, Nothing, "TABLE"})
That resolved the error
Thanks
AW
|
|
|
|
|
i tried to get the big associated icon from the harddrive.
i tried to get a large icon from a folder/file
but it never worked. i used this :
http://www.codeproject.com/KB/files/ExtractIcons.aspx
Some idea?
(with an ico-file it seems to work but i want to have the icon of a directory(...))
thanky for very much!!
|
|
|
|
|
I believe the icon for folders are located in the Shell32.DLL file which you will find in your Windows\System32 folder.
Steve Jowett
-------------------------
Real programmers don't comment their code. If it was hard to write, it should be hard to read.
|
|
|
|
|
you are right
but i need the icons at runtime and if the directory has a special icon, i have no idea how to get it(in 256*256 ,of cource ,otherwise it would be easy)
|
|
|
|
|
Hello, i'm very new to both VBA and Access in general so this may come across as a stupid question.
Basically I have a form which is intended to run a file through a programmer to program IC's. The specific file will vary occasionally.
I have already got the part of the form working which starts up the file and routes it through windows Command line, this part is fine.
But the bit I am a little stuck on is I want to have a seperate button on that form which will simply open "my documents" or somewhere else on the server. This is so that I can select the different program files when neccesarry. This is all. From there i'll try and work out a way have my other button open the selected file each time as opposed to a fixed file name.
So is there any code or techniques to simply have a button open up the file directory window?
Again this may or may not be the simplest question in the world, but I really dont have a clue.
Any help at all would be much appreciated. Thanks.
modified on Friday, July 17, 2009 5:24 AM
|
|
|
|
|
I'm not a VBA expert but from your question i understand you basicly want a dialog that shows files from a directory so the user can select one. There's a standard dialog for this in windows. Search in the VBA help for 'Open file' or 'save file'.
Rozis
|
|
|
|
|
Thanks very much. I couldnt find any info on this on the Access help (which I find useless) but after you mentioned File Dialog I was able to find some source code online. Cheers.
|
|
|
|