|
That's a strange question. an xml file IS a text file. What's the format of this text file ? Do you have an XML schema you want to conform to ? Are you hoping for an automated process ? About the best you'll do there, if it's for arbitrary files, is to put <XML> at the top and </XML> at the bottom, which is of no value whatsoever.
Christian Graus - Microsoft MVP - C++
|
|
|
|
|
I have a Date in the mm/dd/yyyy format(eg. 3/31/2006) how to convert it to dd/mm/yyyy format(ie. 31/3/2006). Both must be in Datetime or Date format... I want to achieve it quick. Is there a function in VB.NET to do that?
Regards,
Pedestrian
|
|
|
|
|
|
Please use function as follows:
Format(System.DateTime.Today, "dd/MM/yyyy")
In place of System.DateTime.Today, you can use date variable
Kumar Prabhakar
|
|
|
|
|
Actually you should avoid using this below. It is contained in the Micorsoft.VisualBasic namespace, which should really be avoided. It is not using the .Net Framework directly, but a VisualBasic wrapper around the .Net framework.
Format(System.DateTime.Today, "dd/MM/yyyy")
Mike Lasseter
|
|
|
|
|
If not using Format function... is there a better solution for VB.Net to convert the date format?
Regards,
Pedestrian
|
|
|
|
|
This
Dim myDate As Date = Date.Now
myDate.ToString("dd/MM/yyyy")
is different than this
Format(date, "dd/MM/yyyy")
Take out the reference to the Micorsfot.VisualBasic Namespace and you will see what I am talking about.
Mike Lasseter
|
|
|
|
|
Hi, I am writing this in hopes that someone out there can help me with the creation or a work around for how to write custom events in vb.net.
eg.
public event CustomEvent as Something
{
add
{
this.Pevent+=value ;
}
remove
{
this.Pevent-=value;
}
}
All that I can do in vb.net seems to be
Private event Pevent as SomethingHandler
Public event CustomEvent as SomethingHandler
I need this event to occur when the user clicks in a cell of a datagrid. It will addhander through a private function. But, I don't know if this is possible or how to do this in vb.net. Help please. Thank you.
eatwork
|
|
|
|
|
Something like this (obtained with Instant VB after adding a delegate declaration):
Public Delegate Sub Something(ByVal sender As Object, ByVal e As System.EventArgs)
Public Custom Event CustomEvent As Something
AddHandler(ByVal value As Something)
AddHandler Me.Pevent, value
End AddHandler
RemoveHandler(ByVal value As Something)
RemoveHandler Me.Pevent, value
End RemoveHandler
RaiseEvent(ByVal sender As Object, ByVal e As System.EventArgs)
End RaiseEvent
End Event
David Anton
www.tangiblesoftwaresolutions.com
Instant C#: VB to C# converter
Instant VB: C# to VB converter
Instant C++: C# to C++ converter and VB to C++ converter
Instant J#: VB to J# converter
Clear VB: Cleans up VB.NET code
Clear C#: Cleans up C# code
|
|
|
|
|
Hi David,
Thank you for your response and solution. I will give that a try, but it looks like it should work. Thank you.
eatwork
|
|
|
|
|
There is an even better way to do this now in Visual Basic for .NET 4.0:
Here is a perfect example of using Visual Basic's Custom Event which also includes new multi-line Lamda's which were available in C# and not VB. I switched to C# since it always seemed ahead of VB and have been really happy yet with .NET, you can always mix and match so can still use things like VB's inline XML for parts of your solution. What is disturbing to me though is that the more I learn about non-Microsoft languages, the more I find out that a lot of this stuff has been done before. Now I just try to learn everything which is impossible and has caused me to go Col. Walter E. Kurtz... The Horror, The Horror...
Here is the link to Bill Wagner's amazing code(It's topic is Tuples feature yet there is a rework of his October 2009 article code using Custom Event, Tuples, and Multi-Line Lamda's that is a perfect example of what you can do and shows what you wanted as well):
|
|
|
|
|
|
hello
i am facing a very small problem related to combo box actually i want to disable text input in combo box like when i run my form u can select an item and u can also modify it although u cant save the changes but why it happens i want to disable not the combobox but only the text writting cursor so u cant write any thing in it so plz help me as soon as possible thanks
|
|
|
|
|
Set the combo box's "DropDownStyle" to "DropDownList"
|
|
|
|
|
ya it works but it don'nt show the display text like "select country" how i can do it
|
|
|
|
|
Set your Text Property to "Select Country"
|
|
|
|
|
Hi,
Directly you wont be able to assign that. What you need to do is when you are binding it at that itself you add that to your datasource.
Best Regards,
Apurva Kaushal
|
|
|
|
|
Hello,
I'm working with the datagridview and I want format the columns with values from a database
code :
For Each DC In DGV.Columns
Dim cell As DataGridViewCell = New DataGridViewTextBoxCell()
'Dim cell As DataGridViewCell = New DataGridViewButtonCell
Me.Text = DataList.TableColumns.Rows.Count
DC.Tag = 0
DC.Tag = DataList.TableColumns.Rows(DC.Index).Item("PrgFormule")
If DC.Tag = 0 Then
cell.Style.BackColor = Color.LightGray
DC.ReadOnly = True
Else
cell.Style.BackColor = Color.White
DC.ReadOnly = False
End If
cell.Style.ForeColor = Color.Blue
DC.DisplayIndex = DataList.TableColumns.Rows(DC.Index).Item("Orde") - 1
DC.AutoSizeMode = DataGridViewAutoSizeColumnMode.None
DC.Width = DataList.TableColumns.Rows(DC.Index).Item("Width")
DC.HeaderText = DataList.TableColumns.Rows(DC.Index).Item("Caption")
Select Case DataList.TableColumns.Rows(DC.Index).Item("Align")
Case 1
cell.Style.Alignment = DataGridViewContentAlignment.MiddleRight
Case 2
cell.Style.Alignment = DataGridViewContentAlignment.MiddleCenter
Case Else
cell.Style.Alignment = DataGridViewContentAlignment.MiddleLeft
End Select
cell.Style.Format = "#0.00"
DC.CellTemplate = cell
Next
DGV.AllowUserToResizeColumns = True
DGV.AllowUserToResizeRows = False
The first time the code works just fine, but after selecting an other list the formatting is not working, then I select the same second list and then it works fine again.....
any suggestions ?
Thanks...
|
|
|
|
|
Interesting. Kschuler(sp?) is having an issue with a mousepointer not working when a user clicks on a column to sort. I wonder if these to issues are related. If there's an inherit problem with the grid loosing formatting after a user clicks the column header, that could cause the cursor to not update as well :/
I don't have any suggestion at the moment, but I'll do some testing and try to recreate the problem. What version of VS are you using?
|
|
|
|
|
Hello,
I'm using VB 2005 express edition. The database is Mysql
The first 3 columns in both list are the same, and there I have the same formatting as in the previous list
so it is like the grid keeps the same celltemplate from the previous list, but the caption is changed
|
|
|
|
|
I want to sort the database in ascending order! how can i make this happen with a button click event? can someone help me please??
Adrian De Battista: .Net Programmer, Java Programmer and Web Designer.
|
|
|
|
|
Typically sorting that is done with a mouse click isn't done by the server. Usually it's done by the container that is displaying the information. Typically a container will have a sort function built in to it. If it doesn't you can add a function to sort the Dataset taht's attached to it, then refresh the container.
If you're wanting to pull the information from the database presorted, then add " ORDER BY " and then the field name you want it sorted on. You can Default is Asc, however you can add "DESC" to the end to get reverse order.
|
|
|
|
|
First of all fill the dataset from the database
Dim myView as DataView
myView = ds.Tables("Customers").DefaultView
Here I am creating a DataView called myView, and assigning the results of the query (ds.Tables("Categories").DefaultView) to it.
You would create sort property by an 'Order By' clause in a SQL query. In an 'Order By' clause, what you're doing is ordering the ouput display by a field or fields in the database, in either Ascending or Descending order. If you add 'DESC', for descending, the default is 'ASC', so you really don't need to address this if your needs are fulfilled with the display results in ascending order.
All you really need to do to sort your dataview is to assign the field or fields you need sorted to the 'Sort' property, like this:
myView.Sort = "Region"
So, to sort by multiple fields, in a Descending order, you'd do it just like you would in an 'Order By' clause:
myView.Sort = "Region, City DESC"
Kumar Prabhakar
|
|
|
|
|
Hi,
I'm working with a sqlserver database & i extract records from it to my application built in vb.net
i have finishid my small app. but now i need to complete my deployement
i have deployed it , not completly because i didn't understand somethings like why adding a key in register & some stuffs
but i had a .msi file & everything is going ok
now i want to know how to take the database with me i mean with the application or with the .msi file
i will give an example to make is more clear
supposing i have my database in "C:\MyDataBase"
now each time i want to install my application in an other PC i have to copy this Data files & past them in the same root "C:\MyDataBase" in the other PC
now i'm asking if it is a possibility to do that just in vb i don't know , sepecifying a root or something like that & then once i install ma application the data files will take there position & i won't have problems in the programme
an other thing , actualy i didn't like the standar forms given with deployement project i want to built my own ones can you tell me how ??
thank you very very much , i hope you undertood that stupide english
try to be good if you can't be the best
|
|
|
|
|
I don't know how to create your own forms for deployment, but I am currently working on a program with a similar database situation. In a setup project bring up the File System Editor. On the side you will see a list of folders including Application Folder, User's Desktop, and User's Programs Menu. What ever you put in these folders will appear in their respective places. This is how you can specify during setup that you want to place a shortcut on the user's desktop for your program, etc. I use the Application Folder as a location for my database and the final .exe of my application. Then, in the code of my application, when I need to setup the connection for my database I use the following code to find the folder my application resides in (which is the same as the database):
My.Computer.FileSystem.GetParentPath(Application.StartupPath) & "MyDatabaseName.mdf"
Hope this helps.
|
|
|
|