Click here to Skip to main content
15,901,426 members
Please Sign up or sign in to vote.
2.00/5 (1 vote)
Hi.

I need some guidance, I have a WinForm app that collects info to connect to a database and column names that will be used. After that I have to show those column values as charts in a html page.

I've been told to use WebApi with my WinForm.

I think that the WebAPi will act as a service to make the file that javascript will read (json) available as url, since javascript can't read a file from local machine (c:\documents\...).

My questions are:

- how can i run the WebApi in my WinForm?
- how can i build the WebApi to do what i want?

Can anyone help me?

If possible can you provide me some example code?

thk for your time
Posted
Comments
Sergey Alexandrovich Kryukov 11-Dec-13 20:05pm    
Do you mean ASP.NET Web API? It has nothing to do with Windows.Forms, but a client can be a Forms application. You don't need Javascript to read JSON, by the way.
—SA
Lopezd 12-Dec-13 9:35am    
but i need javascript to present the charts
Sergey Alexandrovich Kryukov 12-Dec-13 11:46am    
Why? I'm not sure. It depends on what do you want to present and how. You can use Javascript if you embed a WebBrower control in your application, but if you do so, why not making it a Web application?
It all depends...
—SA
Lopezd 12-Dec-13 16:31pm    
i understand what you are saying. the information that was given to me was that this Webapi is to use in another program, basically i'm doing a module that will be added in that program. i have to, based on table data, present a dashboard with charts in a html file
Sergey Alexandrovich Kryukov 12-Dec-13 17:55pm    
You really need to get more information and explain your situation properly.
—SA

1 solution

Why didn't you search Google(I searched Web API + Winform) for this before posting question? :(
CRUD Operation using Web API and Windows Application[^]
 
Share this answer
 
Comments
Lopezd 12-Dec-13 16:33pm    
i have been searching google for the last days looking for something that would give me some explanation on how can i do what i need to do
normalsoft 8-May-14 7:48am    
Me too have the same issue. How can I consume a web API using my class libray?
thatraja 8-May-14 9:11am    
Did you check the link in my answer? that's not help useful? Let me know
normalsoft 11-May-14 0:49am    
I checked it. But my .Net version is 3.5. HttpClient is not available in that version.
Interrobang 14-Jul-15 14:16pm    
I checked that page. I'm not sure if it has what OP needs, but I don't think it has what I need. I want one WinForms application to act as a WebAPI server and a second application to act as a client. As near as I could tell, the link you posted acts as its own server/client. I did not see where the URI included in the source code was configured.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900