|
Have you tried stepping through your code with the debugger to identify the source of the problem? I suggest you familiarize yourself with the concept of debugging if you are not sure what it is.
Unless I am missing something, it doesn't appear as if your DataSet object is assigned any tables. Therefore any attempt to reference a table called 'Books' will throw an error.
Paul Marfleet
"No, his mind is not for rent
To any God or government"
Tom Sawyer - Rush
|
|
|
|
|
pmarfleet wrote: it doesn't appear as if your DataSet object is assigned any tables
He's only declared ds , but has not done anything with it...
"Any sort of work in VB6 is bound to provide several WTF moments." - Christian Graus
|
|
|
|
|
Precisely my point. It does surprise me when people ask questions like this, i.e. where the source of the problem can quickly be found by simply stepping through the code.
Paul Marfleet
"No, his mind is not for rent
To any God or government"
Tom Sawyer - Rush
|
|
|
|
|
hello
first of all thank you very much for your rep.
yes i have stepinto it and it shows that
value for dsNewRow = nothing
waiting for your rep.
thanks you
|
|
|
|
|
Of course it shows Nothing. The statement bombed out because you tried to call the NewRow method on an object that didn't exist. You're looking at the wrong thing. Does the "Books" table exist in that DataSet?? I don't think so...
|
|
|
|
|
I have been researching on this topic for month now but without result......
am trying to put controls on a layered window dat uses per-pixel transparency using updatelayeredwindow function...
although the controls work perfectly yet they r not visible since the entire content of the window is supplied by the updatelayeredwindow function.
The controls which i need to put on the layered form are all owner-drawn ( usercontrols made by me )
i could have drawn them to a common bitmap which will be passed to updatelayeredwindow, but this means that i will have to call the updatelayaredwindow function each time one or more than one controls update their "drawing".....which will slow down my app.....
in the link which i have provided below, the article explains a mechanism of redirection which the setlayeredwindowattributes function uses to calculate alpha value AND paint all child controls on the form......i wonder if i can use this redirection mechanism with updatelayeredwindow too to let windows paint the controls as well as letting me assign a 32bpp bitmap for the background of the form........
Can anyone please help ?
Currently am using 2 different forms for "mimicking" a layered window with controls.....am moving these forms together pretty fast with "deferwindowpos" api.......but since my app is a media player with intended skining abilities like konfabulator, it is becoming increasingly difficult to provide a free form skin due to the 2 different forms....it would be particularly helpful if i can use controls ona layered window without having to paint them all myself....
ANY HELP WILL BE GREATLY APPRECIATED........
here are a few links that might of help :
http://www.freepatentsonline.com/US6549218.html
|
|
|
|
|
Iam using HTTP to call web service without SOAP. It gives Error: 500"
Please anyone tell whats the error.
Actually its status is not 200.
Is there any other method to call webservice using vb6 without SOAP?
Here is my code below:
Public Function Run_WebService(ByRef InForm As Form, ByVal CaseNo As Integer) As Boolean
On Error GoTo Catch
Dim IsOk As Boolean
Dim StrResults As String
Dim ObjXMLHTTP As Object
Dim ObjXMLDOM As Object
Const WebSite As String = "http://localhost/MyService/MyWebService.asmx/"
Dim iPos As Long, jPos As Long
Dim MakeParameters As String
IsOk = False
Set ObjXMLHTTP = CreateObject("Microsoft.XMLHTTP")
Set ObjXMLDOM = CreateObject("Microsoft.XMLDOM")
Select Case CaseNo
Case 1
With ObjXMLHTTP
.Open "GET", WebSite & "MyProduct?ID=5" , False ', "sa", "password"
.Send
DoEvents
If .Status = 200 Then 'is ok
'Load the XML document from the webservice
ObjXMLDOM.loadXML .ResponseText
'check if there are any errors
If ObjXMLDOM.parseError.ErrorCode <> 0 Then
MsgBox .ResponseText
IsOk = False
Else
'Get the results
StrResults = ObjXMLDOM.GetElementsByTagName("string").Item(0).Text
'iPos = InStr(1, StrResults, "<code>", vbTextCompare)
'iPos = iPos + Len("<code>")
'jPos = InStr(1, StrResults, "</code>", vbTextCompare)
'If Val(jPos) = 0 Then
' StrResults = "Invalid Country."
'Else
' StrResults = Mid$(StrResults, iPos, jPos - iPos)
'End If
'InForm.txtResults(0).Text = StrResults
IsOk = True
End If
Else
MsgBox "ERROR - " & .Status, vbCritical, "ERROR"
IsOk = False
End If
End With
End Select
ExitFunction:
Set ObjXMLHTTP = Nothing
Set ObjXMLDOM = Nothing
StrResults = vbNullString
Run_WebService = IsOk
Exit Function
Catch:
MsgBox Err.Description
End Function
Thanks & Regards
Kumaran
|
|
|
|
|
|
hello sir to(Christian Graus)
first of all thank you very much for your all help and i have done it and it's working fine
this is what i have done
Private Sub Display()<br />
Dim NV As Integer<br />
' Open the database.<br />
MyConn = GetDbConnection()<br />
If AskedQ >= MyRecords Then<br />
MsgBox("Hello there is only " & MyRecords & " records in database" & vbCrLf & _<br />
"So please enter " & MyRecords & " or less then " & MyRecords, MsgBoxStyle.Exclamation)<br />
For AI As Integer = 0 To MyRecords<br />
Asked(AI) = False<br />
sorted_indexes.Remove(AI)<br />
Next<br />
AskedQ = 0<br />
lblA.Text = ""<br />
If MsgBox("Would you like to randomize again...?", MsgBoxStyle.Information) = MsgBoxResult.Yes Then<br />
Else<br />
<br />
Exit Sub<br />
End If<br />
Else<br />
' Generate the indexes.<br />
Dim MyRand As New Random<br />
Dim I As Integer<br />
<br />
Do<br />
NV = MyRand.Next(0, MyRecords - I)<br />
Loop Until Asked(NV) = False<br />
Asked(NV) = True<br />
AskedQ += 1<br />
' Save tjhe new value.<br />
indexes(I) = NV<br />
sorted_indexes.Add(NV, NV)<br />
MyQuery = "SELECT * FROM Books " & "WHERE Index=?"<br />
MyCmd = New OleDbCommand(MyQuery, MyConn)<br />
Dim i2 As Integer<br />
' Fetch record i.<br />
Dim index As Integer = indexes(i2)<br />
MyCmd.Parameters.Clear()<br />
MyCmd.Parameters.Add(New OleDbParameter("Index", index))<br />
Dim reader As OleDbDataReader = MyCmd.ExecuteReader(CommandBehavior.SingleRow)<br />
reader.Read()<br />
lblA.Text = reader.Item(i2).ToString<br />
' Close the connection.<br />
MyConn.Close()<br />
MyConn.Dispose()<br />
End If<br />
End Sub
thanks a lot sir
keep helping people like me
|
|
|
|
|
*grin* glad to help.
Christian Graus - Microsoft MVP - C++
"also I don't think "TranslateOneToTwoBillion OneHundredAndFortySevenMillion FourHundredAndEightyThreeThousand SixHundredAndFortySeven()" is a very good choice for a function name" - SpacixOne ( offering help to someone who really needed it ) ( spaces added for the benefit of people running at < 1280x1024 )
|
|
|
|
|
I have defined an enumeration in my c++ dll. Can I use that same enumeration in my visual basic code? I guess my question is if I can export an enumeration from c++/ then import it into my visual basic apps. I know how to use Declare Function/Sub to import functions from c++ dll, but don't know if I can import an enum. I've been googling, but has no luck.
Thanks
|
|
|
|
|
You can't import an enum but you can define it, in VB.NET, so that the byte layout is the same.
Christian Graus - Microsoft MVP - C++
"also I don't think "TranslateOneToTwoBillion OneHundredAndFortySevenMillion FourHundredAndEightyThreeThousand SixHundredAndFortySeven()" is a very good choice for a function name" - SpacixOne ( offering help to someone who really needed it ) ( spaces added for the benefit of people running at < 1280x1024 )
|
|
|
|
|
Hi Guys...!
Any body know..., how to manage installation files package in visual basic 2005 express edition...?
Thanks at all
Best Regards,
Ahmad Rifai Yusuf
|
|
|
|
|
I don't think you can, I think you need to download something like Advanced Installer to do an msi.
Christian Graus - Microsoft MVP - C++
"also I don't think "TranslateOneToTwoBillion OneHundredAndFortySevenMillion FourHundredAndEightyThreeThousand SixHundredAndFortySeven()" is a very good choice for a function name" - SpacixOne ( offering help to someone who really needed it ) ( spaces added for the benefit of people running at < 1280x1024 )
|
|
|
|
|
Hello,
Great resource you guys have here.
I'm doing a database entry project and want to lock down all the fields on the form until the user is in update or add mode. I have a mix of textboxes, drop down lists, radio buttons, and dateTimePickers. I can lock down the textboxes by capturing the KeyPress event, but this did not work for the maskedTextBox, which is VERY annoying. And doesn't work with the other components and doesn't stop mouse access.
Does anyone know of a technique that I can use to lock down all of the controls on the form? I was setting the enabled property of each control but it grays out the text and I don't like the way it looks, either does the user!
All advice is appreciated!
RayG
|
|
|
|
|
Well, the enabled property is there for that, and as you say, the UI makes clear to the end user that a control is disabled by greying it out. If you don't like the default windows behaviour, then you probably want to create your own classes derived from the controls, and write code based on a custom property to reject keyboard and mouse events. But, I think it's nasty. It means your UI doesn't show the user that they can't interact with the controls, that's why they look the way they do when disabled.
Christian Graus - Microsoft MVP - C++
"also I don't think "TranslateOneToTwoBillion OneHundredAndFortySevenMillion FourHundredAndEightyThreeThousand SixHundredAndFortySeven()" is a very good choice for a function name" - SpacixOne ( offering help to someone who really needed it ) ( spaces added for the benefit of people running at < 1280x1024 )
|
|
|
|
|
It's only the ReadOnly for textbox and Enabled for the rest of the controls.
I don't like the dark-gray on gray color scheme when some of the controls are disabled too but so far haven't got users complained about color....
|
|
|
|
|
Hi
I am looping through a Datagridview row by row in an effort to first of all write to a database while also firing a PrintPage event. When the grid contains multiple rows, it loops through just fine when writing all values to the DB. The PrintPage event is also fired the correct number of times as determined by the rowcount but always contains the details of the first row rather than the values of all other rows. Code as follows:
'================================================================<br />
Private Sub btnCreate_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnCreate.Click<br />
Dim x As Int32 = 0<br />
Try<br />
Dim oCmd As New SqlCommand()<br />
Dim Type As String = ""<br />
oCmd = New SqlCommand<br />
For x = 0 To dgvDetails.RowCount - 1<br />
With oCmd<br />
.Connection = oDBCon<br />
Type = dgvDetails.Item(4, x).Value<br />
.CommandText = "INSERT INTO Table Value1,Value2,Value3,Value4,Value5,Value6,Value7,Value8,Value9,Value10,Value11) " + _<br />
"VALUES ('" & Value1.Text & "', '" & Value2.Text & "', '" & Value3.Text & "', '" & Value4.Text & "', '" & Value5.Item(0, x).Value & "'," + _<br />
"'" & Value6.Item(1, x).Value & "', '" & Value7.Item(2, x).Value & "', '" & Value8.Item(3, x).Value & "', '" & Type.Substring(0, 1) & "'," + _<br />
"'" & FormatDateTime(Now, DateFormat.ShortDate) & "', '" & My.Settings.FullName & "')"<br />
.ExecuteNonQuery()<br />
End With<br />
Dim diaPrintDocs As New Printing.PrintDocument<br />
diaPrintDocs = PreparePrintDocument()<br />
diaPrintDocs.Print()<br />
diaPrint.Dispose()<br />
Next<br />
End Try<br />
End Sub<br />
'================================================================
PreparePrintDocument is a function that is called to handle the addressing of the printing output - extract below. Basically, a new PrintPage event needs to be triggered each time it loops through this sub above and at no time will there be a need for continuous pages, just a new page for each row within the DGV. For some reason, that is currently not happening.
'================================================================<br />
Dim x As Int32<br />
With e.Graphics<br />
.DrawImage(oLogoY, 275, 120)<br />
.DrawString("TEXT:", oBF, Brushes.Black, 500, 110)<br />
.DrawString(tbxBillNo.Text, oBF, Brushes.Black, 580, 110)<br />
.DrawString("TEXT", oBF, Brushes.Black, 100, 150)<br />
.DrawString("TEXT", oBF, Brushes.Black, 140, 170)<br />
.DrawString("TEXT", oBF, Brushes.Black, 500, 150)<br />
.DrawString("TEXT", oBF, Brushes.Black, 510, 170)<br />
.DrawString("TEXT", oTF, Brushes.Black, 80, 270)<br />
.DrawString("TEXT", oLF, Brushes.Black, 80, 330)<br />
.DrawString("TEXT", oLF, Brushes.Black, 80, 360)<br />
.DrawString(dgvDetails.Item(0, x).Value, oBF, Brushes.Black, 165, 359)<br />
End With<br />
'================================================================
Would anyone possibly have some ideas on how to address this issue? Help would be greatly appreciated.
|
|
|
|
|
Hi guys not exactly sure if parsing is the right terminology but I was wondering if someone can help me understand what I need to do. Here is what I hope my program to do...and also where I am stuck.
The program should be very simple containing only 1 textbox, 1 button, and one label to display the result.
The object of the program is to assign a number to each letter in the alphabet for example a=1 b=2 c=3 etc. and then calculate the textbox based on the letters it contains. the display the result in label1.text
when u fill in the textbox and press the button I want to be able to read the textbox value and parse each letter so that they can be added up based on their number value
right now on my form I have
Dim aa as integer = 1
dim bb as integer = 2
all the way to zz
Dim zz as integer = 26
in the button I have only
dim calctext as string = textbox1.text
now i guess i need to parse calctext somehow and store their values or add them directly. Just not sure where to start here and what the best way would be.
I guess my last question is on the form where i delcared aa and bb as integers etc. I used double letters like aa and bb because I didn't know if there would be conflict later on with the parsed variables...would there be?
Thanks in advance guys for any input...I'd appreciate a nudge in the right direction for the commands I should use. I learn best by trying.
|
|
|
|
|
1. First you should store the corresponding alphabet and number pair in a Dictionary. Not saying defining them from aa to zz won't work, but using Dictionary allows you to expand later on. You need to initialize the Dictionary, though.
2. Then you should break down the text in the textbox into an array of char (or string). You can use List for that too.
3. You go through the array of char or string, find the corresponding alphabet in the Dictionary, get the integet number assigned, and add the number to a count.
4. Display the count in the label.
|
|
|
|
|
Hi and thankyou very much for the response...but I am sorry maybe I didn't express my needs properly. I understand I need to breakdown the textbox into seperate letters...I just don't know the command I should be using...is it PARSE? or split or what...i'm just lost I don't know if I'll ever get this there is so much to know.
|
|
|
|
|
You can use a loop and SubString to go thru each char (as string), or you can use .Text.ToCharArray to generate an array of char, then go thru the array of char.
|
|
|
|
|
hi,
please help me, i want to make an application which implement linq features (linq to sql,linq to object and linq to xml) nah, what kind of application would be best for it ? since i have to use xml (linq to xml), is that mean i have to build a web application ? please help me for idea... any suggestion will be a great help.
thank you very much,
ganero
|
|
|
|
|
ganero wrote: since i have to use xml (linq to xml), is that mean i have to build a web application ?
This question tells me you want to play with LINQ for the sake of it, but don't have a grasp on basics. No, XML is not web only.
I'd recommend working through a beginner book and doing hte LINQ chapter when you get to it.
Christian Graus - Microsoft MVP - C++
"also I don't think "TranslateOneToTwoBillion OneHundredAndFortySevenMillion FourHundredAndEightyThreeThousand SixHundredAndFortySeven()" is a very good choice for a function name" - SpacixOne ( offering help to someone who really needed it ) ( spaces added for the benefit of people running at < 1280x1024 )
|
|
|
|
|
thanks Christ, yes like you said, i want to experiment linq but i need to implement it in one application ( 'I MUST BUILD an APPLICATION' ) and so the problem is i don't know what to make... i mean, idea, if you don't mind, i'm asking for a application title - could you give me some ?
thank you
|
|
|
|
|