|
Why don't you start with trying to manipulate the data in a single, known table, before you get into the more advanced stuff of manipulating the system tables in a database.
|
|
|
|
|
Hi,
I'm having trouble trying to create a relation between two DataTable in my DataSet. Im getting an error saying "NullReferenceException was unhandled"
I have a DataSet call "myDataSet"
I have two tables call "ConsoleDT" and "GameDT"
The primary key in ConsoleDT is "ConsoleID" and GameDT also has a column called "ConsoleID"
Heres my code
Dim Fkey As New ForeignKeyConstraint("FKGameConsole", myDataSet.Tables("ConsoleDT").Columns("ConsoleID"), myDataSet.Tables("GameDT").Columns("ConsoleID"))
myDataSet.Tables("ConsoleDataTable").Constraints.Add(Fkey)
Thanks
|
|
|
|
|
Your code is assuming that you actually have a table called "ConsoleDT" in myDataSet. It's also assuming that that table has a column called "ConsoleID". It's also assuming that there is a table called "GameDT" and that it has a column called "ConsoleID". And so on, and so on... It would probably be a good idea to check if these things exist before you try and use them.
|
|
|
|
|
Hmm I'm not sure I get you sorry. These things do exist, and have been created before I try to create the Foreign Key.
|
|
|
|
|
It would help to diagnose your problem if, when the exception occurs, you move the cursor over each member in the offending line, until you find the one that is Nothing.
If you then post back here with those details, you're more likely to get useful help.
Henry Minute
Do not read medical books! You could die of a misprint. - Mark Twain
Girl: (staring) "Why do you need an icy cucumber?"
“I want to report a fraud. The government is lying to us all.”
|
|
|
|
|
Sure, those things exist in the database, but are they objects in your code?? Or do those references return "Nothing", or null in the C, C++, C# worlds. When the code breaks and returns to the debugger, you can check to see if those objects actually return anything by hovering the mouse of them or looking in the Local Watch window.
|
|
|
|
|
Hi guys,I have a project to come up with a calculator to perform basic addition,subtraction,multiplication and division. I came up with the code below but it only adds correctly the first time...multiple addition always gives me a wrong answer and so does any attempted subtraction,multiplication and division....point out the errors please
CALCULATOR CODE:
Public Class Form1
Dim total1 As Single
Dim total2 As Single
Dim total3 As Single
Dim result As Single
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
End Sub
Private Sub btn5_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btn5.Click
txtdisplay.Text = Val(txtdisplay.Text) & Val(btn5.Text)
End Sub
Private Sub btn1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btn1.Click
txtdisplay.Text = Val(txtdisplay.Text) & Val(btn1.Text)
End Sub
Private Sub btn2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btn2.Click
txtdisplay.Text = Val(txtdisplay.Text) & Val(btn2.Text)
End Sub
Private Sub btn3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btn3.Click
txtdisplay.Text = Val(txtdisplay.Text) & Val(btn3.Text)
End Sub
Private Sub btn4_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btn4.Click
txtdisplay.Text = Val(txtdisplay.Text) & Val(btn4.Text)
End Sub
Private Sub btn6_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btn6.Click
txtdisplay.Text = Val(txtdisplay.Text) & Val(btn6.Text)
End Sub
Private Sub btn7_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btn7.Click
txtdisplay.Text = Val(txtdisplay.Text) & Val(btn7.Text)
End Sub
Private Sub btn8_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btn8.Click
txtdisplay.Text = Val(txtdisplay.Text) & Val(btn8.Text)
End Sub
Private Sub btn9_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btn9.Click
txtdisplay.Text = Val(txtdisplay.Text) & Val(btn9.Text)
End Sub
Private Sub btnzero_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnzero.Click
txtdisplay.Text = Val(txtdisplay.Text) & Val(btnzero.Text)
End Sub
Private Sub btnadd_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnadd.Click
total1 = Val(txtdisplay.Text)
total1 = total1 + Val(txtdisplay.Text)
total2 = total1
result = total2
txtdisplay.Clear()
End Sub
Private Sub btneql_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btneql.Click
txtdisplay.Text = result
End Sub
Private Sub btnclear_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnclear.Click
txtdisplay.Clear()
total1 = 0
End Sub
Private Sub btntimes_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btntimes.Click
total1 = Val(txtdisplay.Text)
total1 = total1 * Val(txtdisplay.Text)
total2 = total1
result = total2
txtdisplay.Clear()
End Sub
Private Sub Buttbtndivideon15_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Buttbtndivideon15.Click
total1 = Val(txtdisplay.Text)
total1 = total1 / Val(txtdisplay.Text)
total2 = total1
result = total2
txtdisplay.Clear()
End Sub
Private Sub btnless_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnless.Click
total1 = Val(txtdisplay.Text)
total1 = total1 - Val(txtdisplay.Text)
total2 = total1
result = total2
txtdisplay.Clear()
End Sub
End Class
|
|
|
|
|
keymoney wrote: point out the errors please
Other than the entire application?? Serisouly, IMHO, the entire thing needs to be scrapped and rewritten.
I'll give you a hint. You only need to keep track of two numbers. The first is an accumulator, the second is the current value in the display. All the math operations occur using just those two numbers.
|
|
|
|
|
keymoney wrote: ...it only adds correctly the first time...
Are you sure?
Trying to follow your logic, enter 15, press add, result now equals 30, display cleared. Enter 6, press equals, display shows 30, instead of 21, the actual sum. (Or at least I think it does - just reading it makes my head hurt...)
Your logic is, for want of a better word, insane.
total1 = Val(txtdisplay.Text)
total1 = total1 + Val(txtdisplay.Text)
total2 = total1
result = total2
What, exactly, do you think that code does? You need to step through in debug mode, looking at the values of the variables you're setting. Then, as Dave K. above suggests, throw it away and start again...
There are three kinds of people in the world - those who can count and those who can't...
|
|
|
|
|
Hi,
I am doing a project related to School management. In that i was assigned by a module called Accounts Module. In this module i have to create Groups(like Assets,Liabilities,etc.,) and Accounts in the Treeview format.
I have one Textbox and two Comboboxes, in one combobox i have to select Group/Account, In the other combobox, i have to select 'under' which group the textbox value should be saved. We can add 'n' number of childs, sub childs Under the Groups, But when we select Value in the combobox as Account, we cannot add any values under the Account.
For better understanding, i will give a sample Treeview structure..
Assets (Group)
|-Current Assets (Group)
|-sample1 (Account)
|-sample2 (Account)
|-fixed assets (Group)
|-samp1 (Account)
liabilities (Group)
|-current liabilities (Group)
|-samp1 (Group)
|-samp2 (Acccount)
i think this is the best example..
Can anyone please help me in completing this Task..
Thanks in Advance,
Victoria
VB.Net
|
|
|
|
|
Is it possible to align the Richtextbox text as fullfill the blank spaces.
I mean, if the richtextbox is entered half line, and remianing blank spaces of half line has to remove and the text has to be upto the end of that line like, word alignment
I set the followings
RichTextbox1.Maxlength=300
RichTextBox1.SelectionStart = 0
RichTextBox1.SelectionLength = 0
Thanks
|
|
|
|
|
Not supported. You'll have to find a 3rd party control that does support what you want, or (much more difficult) write your own version of the RTB.
|
|
|
|
|
Hello All,
Actually I am working with mobile application for sending sms for list. But When i am try to send message by using thread the mobile will be hang and Message not sends.
CScreateprocess is a function for sending sms. It takes time for sending sms because it checks credential.
If you can think then I Can.
|
|
|
|
|
What do the docs for the SMS API you're using say ?
Christian Graus
Driven to the arms of OSX by Vista.
Please read this[ ^] if you don't like the answer I gave to your question.
"! i don't exactly like or do programming and it only gives me a headache." - spotted in VB forums.
|
|
|
|
|
CeCreatePRocess Is used for Sending SMS.
If you can think then I Can.
|
|
|
|
|
No, CeCreateProcess is used on Windows CE to create a new process, like Process.Start. You may well be able to start a process that sends an SMS, but CeCreateProcess is, in itself, nothing to do with SMS, in any way, shape or form. RTFM.
Christian Graus
Driven to the arms of OSX by Vista.
Please read this[ ^] if you don't like the answer I gave to your question.
"! i don't exactly like or do programming and it only gives me a headache." - spotted in VB forums.
|
|
|
|
|
eg_Anubhava wrote: Actually I am working with mobile application for sending sms for list. But When i am try to send message by using thread the mobile will be hang and Message not sends. "Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow Never mind - my own stupidity is the source of every "problem" - Mixture
cheers,
Alok Gupta
VC Forum Q&A :- I/IV
Support CRY- Child Relief and You
|
|
|
|
|
NO IT'S WRONG. MY FUNCTION AND LOOP IS CORRECT.
THE PROBLEM IS THAT WHEN I M SENDING MESSAGE CeCreatePROCESS TAKES REQUEST FROM SERVER AND THIS TIME ANOTHER RESUEST IS COMES FOR SENDING MESSAGE. AND THEN MOBILE WILL BE HANG. SO SOME MESSAGE NOT SEND.
If you can think then I Can.
|
|
|
|
|
|
what it means.
If you can think then I Can.
|
|
|
|
|
Actually i am having a list of controls in multiple Controls selections like Picturebox,Textbox ,Label,LinkLabel etc .
Now i got Picturebox in the Multiple selection of control .
In cCustomProperties Class i am having FORECOLOR ,BACKCOLOR ,FONT ,SIZE , LOCATION
Common Properties class all the controls to show for multiple controls if selected in the propertygrid.
Case :: 1
If i get the PICTUREBOX in the List Of Multiple Controls i want to hide the FONT,FORECOLOR,BACKCOLOR Properties and to show only LOCATION,SIZE PROPERTIES .
Case :: 2
For LINKLABEL i am fixing the size of the Linklabel to 7,7 and label text as * .So if i get the linkLabel in the list of Multiple controls i want to hide the SIZE ,FORECOLOR,BACKCOLOR PROPERTIES
Presently i am taking different class for all these conditions and doing Permutations & Combinations . Which is Risky THING TO DO THE THINGS . I want to Stop doing all these non-Sense things .
I want to implement the way in visual studio if Multiple Controls are selected . In the PropertyGrid i get only the properties which are common to all the controls .
Ex :: Consider the label and Picturebox in Multiple Selection. THE FONT PROPETY is hiding . IN THIS WAY DYNAMICALLY .
Regards
|
|
|
|
|
I've never done anything like that before, but I can think of one method that might work.
Enumerate the properties of each control. Put the property names in a collection and count the name of times each property is found for each control. Now go through the collection of property names and look at their count values. If the count equals the number of controls selected, you've found your common property names.
|
|
|
|
|
I compress data in a stored procedure delivering it to the applicatiom as a dataset. That dataset is then bound to the aspx page in a datalist and a textbox.
If the data is entered in the textbox, then I need to extract the data from the datalist on that row. I know there is a way to get the textbox data with a "FindControl", no problem, I just don't know how to get the rest of the data for that row.
Can you assist with 1 or 2 lines of VB code, as to how to return the actual data from the row.
Thanks
Chuck
modified on Friday, June 5, 2009 12:42 PM
|
|
|
|
|
I can't, but somebody in the ASP.Net forum is likely to be able to.
Henry Minute
Do not read medical books! You could die of a misprint. - Mark Twain
Girl: (staring) "Why do you need an icy cucumber?"
“I want to report a fraud. The government is lying to us all.”
|
|
|
|
|
Thanks for trying Henry, but this is not an ASP.Net problem. This a VB.NET WebForm code problem. I asked an application code question in asp forum yesterday and got shouted out. I wont do that twice.
|
|
|
|
|