|
When I move the cursor to the last row in my DataGrid a new record is added to the DataView. The new row fields contain DBNull values. When the new row is added how can I automatically assign values to these fields so they are not null?
Thanks
|
|
|
|
|
Programmatically you do it like this.
DataSet1.Tables("TABLE_NAME").Columns("COLUMN_NAME").DefaultValue = "Me"
Otherwise go into your dataset properties and then tables and finally columns. Once there click on your column and find the property DefaultValue.
HTH,
Jason
|
|
|
|
|
What is the syntax when using the finally columns?
|
|
|
|
|
Finally mean final step!
Regards,
Asim
|
|
|
|
|
I am trying to populate a combobox from an XML and I am not sure if the data should be stored as an attribute like this <bolt_standards a="Metric" b="UNC/UNF">, which can not be numbers only or <m5>10,12,14,16,20,25,30,35,40,50, and extract the whole string and use a delimiter "," used to split the values or possibly like this
<m6>
0 = "12"
1 = "16"
2 = "20"
3 = "25"
4 = "30"
5 = "35"
6 = "40"
7 = "45"
8 = "50"
9 = "55"
10 = "60"
11 = "65"
12 = "70"
13 = "75"
14 = "80"
15 = "90"
16 = "100"
|
|
|
|
|
|
What I am trying to do is read a text file and count the amount of instances where there is a value after the string I am searching
For example(example of the text file which may have 12 houses)
house1=This spot is taken
house2=This spot is taken
house3=
house4=
I want to search through the text file for the "=" then see if there is any data after the "="...
The Readline() method will help me read the text file line by line and I can also use an if statement to see if the "=" is on the particular line...but how do I gather the characters after the "="
Thanks
Andrew
|
|
|
|
|
Once you've read a line, use the Split() function to break it down into two parts which are delimited by the "=" sign thus:
' Assume sInput holds the line just read from the file...<br />
<br />
Dim arr() as string<br />
arr = Split(sInput, "=", 2)<br />
<br />
' arr(0) now contains the text before the "=" sign<br />
' arr(1) now contains the text after the "=" sign<br />
If there is no text after the "=" sign then arr(1) will be an empty string.
...Steve
|
|
|
|
|
That worked great thanks!
Is there a way to point the cursor to a specific part of the text file? like if I wanted to only read lines 7-30 of the text file? or even from a specific word in the text which is basically a title to the block of text
for example...
This section here is garbage but there is an = here
[This is the title of the block I want to work with]
house1=This spot is taken
house2=This spot is taken
house3=
house4=
I do not want to read any more information after house 4 for instance
Andrew
|
|
|
|
|
kongo10 wrote: That worked great thanks!
You're welcome.
kongo10 wrote: Is there a way to point the cursor to a specific part of the text file? like if I wanted to only read lines 7-30 of the text file? or even from a specific word in the text which is basically a title to the block of text
Hmmm.... how large is the file? In the VB 6.0 way you could call the kernel GetPrivateProfileString() INI file function and it's supporting functions to go to the requested section and obtain the value automatically (almost) but in .NET this is shunned in favour of using XML files.
These subjects are a little harder to put into a few words here, so I'd suggest searching the net (or www.codeproject.com articles) for suitable code.
Another suggestion is that if the file is relatively small and/or only going to be read all the way through once in your program is to simply read the file line-by-line until you get to where you want to start then parse the data as per previous reply in this thread. Much simpler although not quite as 'correct'.
...Steve
|
|
|
|
|
Hi all, I'm trying to have the parent form auto populate the three fields to its subform. Is this posilble??? Help!!!
thank you in avdance.
|
|
|
|
|
What do you mean by auto populate fields. Are you saying you want to open a form and then once the form is open have data sent to three different text boxes in the sub form?
VBA Code
Form_FormName.TextBoxName.Value = ""
or
Form_FormName.TextBoxName.Text = ""
HTH,
Jason
|
|
|
|
|
Thanks, But i try that and didn't work. It is possible that I'm l doing something wrong.
This is what is did:
I go to the code envir - form afterupdated of the subform then i type the
Form_Crs.crs_cd.Value = ""
Please tell what am I doing wrong?
Thanks
|
|
|
|
|
Hello all...
I a windows service that starts a new thread in the onstart event to do the work. The work has a while loop that listens to a TCP connection which blocks on the stream.read call. There may or may not be any packet for up to 30 seconds and I need to update data more often than that, about every one second. I have a timer which should tick every 1 sec but the while loop that listens to the TCP stream seems to keep the tick event from firing. The timer.start call is inside the thread. Any ideas on how to get that tick event to fire? Or a better solution?
Thanks in advance...
"Half this game is ninety percent mental."
- Yogi Berra
|
|
|
|
|
hellow to all ..
how can i convert a sting to a date type ..
and then substract it from another date ?
|
|
|
|
|
What i did is adding the "/" and "#" to the string and get the difference by using DateDiff
So, it's like this
dim d as date
d = "#" + month.Tostring + "/" + date.Tostring + "/" + year.tostring + "#"
dim day as integer
day = DateDiff(DateInterval.Day, d, WhateverDate)
You can change the Dateinterval to your liking.
Hope that helps
|
|
|
|
|
Hi guys!
need some help..
i want to use hindi fonts in my application also i want to save the data in sql2000 in hindi..for displaying it later
can any one help me as i m searching for it but cant find the appropriate help.
abhinav
|
|
|
|
|
How do I create a Validated event for a TextBox that is in a DataGrid?
Thanks
|
|
|
|
|
I am recreating a program originally written in Foxpro, which is nearly complete. I am running into a design problem causing me some grief. Basically the program is a form connected to a database displaying the fields in texbox. The original Foxpro program saved the changes made if the person moved out of the textbox, or tabbed out. Pretty convienent for them, and they are used to that. The Foxpro update is almost instant.
Ok mine has an update button, takes about 9 seconds for the adapters to update. If I tie this into any control it will take that long. I know that the design is different, but is this what I am stuck with ? I know nothing of Foxpro but it seems it is updated just that one field and mine is updating everything ? Mine is updating like this...
dataset1.Update(ChangedRows)
|
|
|
|
|
You could try using the OleDbCommand instead of the DataAdapter for your update. You will have less overhead. Also Dataset1.Update updates the whole DataSet which takes more time then updating one table row using OleDbCommand. Not sure how much of a difference this will make. 9 seconds seems like along time - is the database server being over worked?
I'm a long time FoxPro programmer switching to VB .Net and I can say in your example FoxPro will always be quicker because in FoxPro the table is already opened and at the correct record. In VB .NET you have to make a connection and send the update command.
|
|
|
|
|
It should not be updating the entire dataset, just that one adapter. I am using something like this.
dataadapter1.Update(ChangedRows)
I figure it close to 8 seconds. I tried to shorten the update statement, that did not seem to help any at all. Your question about the database being overworked ? Nah, I am the only one on it and the server is rather robust. I did borrow this code from someone maybe it is at fault ? This is in the update subroutine.
'Create a new dataset to hold the changes that have been made to the main dataset.<br />
Dim objDataSetChanges As BA_Application.DataSet1 = New Application.DataSet1<br />
'Stop any current edits.<br />
Me.BindingContext(DataSet11, "customer").EndCurrentEdit()<br />
Me.BindingContext(DataSet11, "inventory").EndCurrentEdit()<br />
Me.BindingContext(Dataset11, "orders").EndCurrentEdit()<br />
'Get the changes that have been made to the main dataset.<br />
objDataSetChanges = CType(DataSet11.GetChanges, Application.DataSet1)<br />
'Check to see if any changes have been made.<br />
If (Not (objDataSetChanges) Is Nothing) Then<br />
Try<br />
'There are changes that need to be made, so attempt to update the datasource by<br />
'calling the update method and passing the dataset and any parameters.<br />
Me.UpdateDataSource(objDataSetChanges)<br />
DataSet11.Merge(objDataSetChanges)<br />
DataSet11.AcceptChanges()<br />
Catch eUpdate As System.Exception<br />
'Add your error handling code here.<br />
Throw eUpdate<br />
End Try<br />
'Add your code to check the returned dataset for any errors that may have been<br />
'pushed into the row object's error.<br />
End If
-- modified at 13:08 Thursday 17th November, 2005
|
|
|
|
|
rem out this line
DataSet11.Merge(objDataSetChanges)
|
|
|
|
|
hai,
I am using Rich Text box control for displaying the status in my project.when the text exceeds the control's size i can't able to see the status .Is there is way to always focus at new entered text position.
with Thanks and regards,
P.Gerald Manickam
|
|
|
|
|
Please let me know how to get height , width in pixel of screen in VB net
Thanks
|
|
|
|
|